Skip to content

Commit

Permalink
Merge branch 'main' into anmol/ics-support
Browse files Browse the repository at this point in the history
  • Loading branch information
Anmol1696 authored Jun 27, 2024
2 parents 631f58b + 05f69b7 commit 15fa3b9
Show file tree
Hide file tree
Showing 38 changed files with 301 additions and 196 deletions.
3 changes: 1 addition & 2 deletions .github/actions/e2e-test/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,9 @@ runs:

- name: Setup Test infra
id: starship-action
uses: cosmology-tech/[email protected].1
uses: cosmology-tech/[email protected].5
with:
config: ${{ env.CONFIG_FILE }}
version: 0.0.0
chart: ./starship/charts/devnet
kubeconfig: ${{ steps.kubeconfig.outputs.content }}
cli-version: 0.0.0
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- "!starship/docker/**"
- ".github/workflows/pr-tests.yaml"
types: [opened, reopened, synchronize, ready_for_review]
workflow_dispatch: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-pr-tests
Expand Down Expand Up @@ -75,10 +76,9 @@ jobs:
- name: Setup Test infra
id: starship-action
uses: cosmology-tech/[email protected].1
uses: cosmology-tech/[email protected].5
with:
config: ${{ env.CONFIG_FILE }}
version: 0.0.0
chart: ./starship/charts/devnet
cli-version: 0.0.0

Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/smoke-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@ jobs:
- name: Setup Test infra
id: starship-action
uses: cosmology-tech/[email protected].1
uses: cosmology-tech/[email protected].5
with:
config: ${{ env.CONFIG_FILE }}
version: 0.0.0
chart: ./starship/charts/devnet
cli-version: 0.0.0

Expand Down Expand Up @@ -115,10 +114,9 @@ jobs:
- name: Setup Test infra
id: starship-action
uses: cosmology-tech/[email protected].1
uses: cosmology-tech/[email protected].5
with:
config: ${{ env.CONFIG_FILE }}
version: 0.0.0
chart: ./starship/charts/devnet
cli-version: 0.0.0

Expand Down Expand Up @@ -176,10 +174,9 @@ jobs:
- name: Setup Test infra
id: starship-action
uses: cosmology-tech/[email protected].1
uses: cosmology-tech/[email protected].5
with:
config: ${{ env.CONFIG_FILE }}
version: 0.0.0
chart: ./starship/charts/devnet
cli-version: 0.0.0

Expand Down
10 changes: 8 additions & 2 deletions clients/go/client/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ require (
github.com/go-kit/kit v0.12.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
Expand Down Expand Up @@ -153,17 +155,21 @@ require (
github.com/zondax/ledger-go v0.14.1 // indirect
go.etcd.io/bbolt v1.3.7 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/exp v0.0.0-20230310171629-522b1b587ee0 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/term v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/api v0.169.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect
Expand Down
109 changes: 50 additions & 59 deletions clients/go/client/go.sum

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions clients/js/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*.json
*.md
*.css
*.d.ts

node_modules/
dist/
main/
module/
coverage/
14 changes: 7 additions & 7 deletions clients/js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,15 @@ npm install @starship-ci/client
First, you need to import and initialize the `StarshipClient` with your Helm configuration:

```js
import { StarshipClient } from '@starship-ci/client';
import {StarshipClient} from '@starship-ci/client';

const client = new StarshipClient({
helmName: 'osmojs',
helmFile: 'path/to/config.yaml',
helmRepo: 'starship',
helmRepoUrl: 'https://cosmology-tech.github.io/starship/',
helmChart: 'devnet',
helmVersion: 'v0.2.3'
name: 'osmojs',
config: 'path/to/config.yaml',
repo: 'starship',
repoUrl: 'https://cosmology-tech.github.io/starship/',
chart: 'devnet',
version: 'v0.2.3'
});
```

Expand Down
3 changes: 3 additions & 0 deletions clients/js/__fixtures__/config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
name: starship
version: v0.2.3

chains:
- id: osmosis-1
name: osmosis
Expand Down
3 changes: 3 additions & 0 deletions clients/js/__fixtures__/local-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
name: starship
version: v0.2.3

chains:
- id: osmosis-1
name: osmosis
Expand Down
2 changes: 0 additions & 2 deletions clients/js/__fixtures__/starship-context-config.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions clients/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"clean": "lerna run clean",
"build": "lerna run build --stream",
"symlink": "symlink-workspace --logLevel error",
"lint": "lerna run lint",
"format": "lerna run format",
"postinstall": "yarn symlink",
"publish": "yarn build; yarn lerna publish --no-private",
"publish:minor": "yarn build; yarn lerna publish minor --no-private"
Expand Down
6 changes: 6 additions & 0 deletions clients/js/packages/cli/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules/
dist/
main/
module/
coverage/
prompt.js
20 changes: 20 additions & 0 deletions clients/js/packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,26 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [2.9.0](https://github.com/cosmology-tech/starship/compare/@starship-ci/[email protected]...@starship-ci/[email protected]) (2024-06-24)

**Note:** Version bump only for package @starship-ci/cli

## [2.8.1](https://github.com/cosmology-tech/starship/compare/@starship-ci/[email protected]...@starship-ci/[email protected]) (2024-06-21)

**Note:** Version bump only for package @starship-ci/cli

# [2.8.0](https://github.com/cosmology-tech/starship/compare/@starship-ci/[email protected]...@starship-ci/[email protected]) (2024-06-21)

**Note:** Version bump only for package @starship-ci/cli

## [2.7.2](https://github.com/cosmology-tech/starship/compare/@starship-ci/[email protected]...@starship-ci/[email protected]) (2024-06-21)

**Note:** Version bump only for package @starship-ci/cli

## [2.7.1](https://github.com/cosmology-tech/starship/compare/@starship-ci/[email protected]...@starship-ci/[email protected]) (2024-06-21)

**Note:** Version bump only for package @starship-ci/cli

# [2.7.0](https://github.com/cosmology-tech/starship/compare/@starship-ci/[email protected]...@starship-ci/[email protected]) (2024-06-19)

**Note:** Version bump only for package @starship-ci/cli
Expand Down
6 changes: 4 additions & 2 deletions clients/js/packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@starship-ci/cli",
"version": "2.7.0",
"version": "2.9.0",
"author": "Dan Lynch <[email protected]>",
"description": "Starship CLI",
"main": "index.js",
Expand Down Expand Up @@ -29,6 +29,8 @@
"build": "npm run clean; tsc; tsc -p tsconfig.esm.json; npm run copy; npm run chmod",
"chmod": "chmod +x dist/index.js",
"dev": "ts-node src/index",
"lint": "eslint .",
"format": "eslint . --fix",
"test": "jest",
"test:watch": "jest --watch"
},
Expand All @@ -53,7 +55,7 @@
"@types/js-yaml": "^4.0.9"
},
"dependencies": {
"@starship-ci/client": "^2.7.0",
"@starship-ci/client": "^2.8.0",
"chalk": "^4.1.0",
"deepmerge": "^4.3.1",
"inquirerer": "^1.9.0",
Expand Down
8 changes: 4 additions & 4 deletions clients/js/packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { StarshipClient, StarshipInstaller } from '@starship-ci/client'; // Adju
import { Inquirerer, type Question } from 'inquirerer';
import minimist from 'minimist';

import { displayUsage, displayVersion, loadConfig, usageText, params } from './utils';
import { displayUsage, displayVersion, loadConfig, params,usageText } from './utils';

const argv = minimist(process.argv.slice(2), {
alias: {
Expand All @@ -28,11 +28,11 @@ const questions: Question[] = params.map(name => ({ name, type: 'text' }));

// Filter questions based on the command
function getQuestionsForCommand(command: string): Question[] {
const commonQuestions = questions.filter(q => q.name !== 'helmFile');
const commonQuestions = questions.filter(q => q.name !== 'config');
if (['start', 'deploy', 'start-ports', 'wait-for-pods'].includes(command)) {
return questions; // Include all questions, including helmFile
return questions; // Include all questions, including config
} else {
return commonQuestions; // Exclude helmFile
return commonQuestions; // Exclude config
}
}

Expand Down
51 changes: 24 additions & 27 deletions clients/js/packages/cli/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import {defaultStarshipContext, StarshipConfig, StarshipContext} from '@starship-ci/client'; // Adjust the import path as necessary
import { type Question } from 'inquirerer';
import chalk from 'chalk';
import {readFileSync} from 'fs';
import * as yaml from 'js-yaml';
import {dirname, resolve} from 'path';
import { resolve} from 'path';

import {readAndParsePackageJson} from './package';
import deepmerge from 'deepmerge';

// Function to display the version information
export function displayVersion() {
Expand All @@ -32,25 +30,20 @@ export interface Config {
}

export const params: string[] = [
'helmName',
'helmFile',
'helmRepo',
'helmRepoUrl',
'helmChart',
'helmVersion',
'helmNamespace',
'config',
'name',
'version',
'repo',
'repoUrl',
'chart',
'namespace',
]

export const loadConfig = (argv: any): Config => {
console.log("argv: ", argv);
console.log("argv.config: ", argv.config);
let context: StarshipContext = { ...defaultStarshipContext } as StarshipContext;
let starship: StarshipConfig = {} as StarshipConfig;

if (argv.config) {
context = deepmerge(defaultStarshipContext, loadYaml(argv.config)) as StarshipContext
}

console.log("context", context);

// Override context with command-line arguments dynamically based on StarshipContext keys
Expand All @@ -62,10 +55,9 @@ export const loadConfig = (argv: any): Config => {
}
});

if (context.helmFile) {
const dir = argv.config ? dirname(argv.config) : process.cwd();
context.helmFile = resolve(resolvePath(dir), context.helmFile);
starship = loadYaml(context.helmFile) as StarshipConfig
if (context.config) {
context.config = resolvePath(context.config);
starship = loadYaml(context.config) as StarshipConfig
}

console.log("starship: ", starship);
Expand All @@ -89,19 +81,24 @@ Commands:
version, -v Display the version of the Starship Client.
Configuration File:
--config <path> Specify the path to the JSON configuration file containing all settings.
--config <path> Specify the path to the configuration file containing the actual config file. Required.
Command-line options will override settings from this file if both are provided.
Command-line Options:
--helmFile <path> Specify the path to the Helm file, the actual config file. Required.
--helmName <name> Specify the Helm release name, default: starship.
--helmVersion <ver> Specify the version of the Helm chart, default: v0.2.0.
--name <name> Specify the Helm release name, default: starship.
Will overide config file settings for name.
--version <ver> Specify the version of the Helm chart, default: v0.2.6.
Will overide config file settings for version.
Examples:
$ starship setup
$ starship deploy --helmFile ./config/helm.yaml --helmName my-release
$ starship start-ports --config ./config/settings.json
$ starship stop --config ./config/settings.json
$ starship start --config ./config/two-chain.yaml
$ starship stop --config ./config/two-chain.yaml
If you want to run the deployment step by step
$ starship deploy --config ./config/two-chain.yaml
$ starship start-ports --config ./config/two-chain.yaml
$ starship stop-ports --config ./config/two-chain.yaml
$ starship stop --config ./config/two-chain.yaml
Additional Help:
$ starship help Display this help information.
Expand Down
6 changes: 6 additions & 0 deletions clients/js/packages/client/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules/
dist/
main/
module/
coverage/
prompt.js
12 changes: 12 additions & 0 deletions clients/js/packages/client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [2.8.0](https://github.com/cosmology-tech/starship/compare/@starship-ci/[email protected]...@starship-ci/[email protected]) (2024-06-24)

**Note:** Version bump only for package @starship-ci/client

## [2.7.2](https://github.com/cosmology-tech/starship/compare/@starship-ci/[email protected]...@starship-ci/[email protected]) (2024-06-21)

**Note:** Version bump only for package @starship-ci/client

## [2.7.1](https://github.com/cosmology-tech/starship/compare/@starship-ci/[email protected]...@starship-ci/[email protected]) (2024-06-21)

**Note:** Version bump only for package @starship-ci/client

# [2.7.0](https://github.com/cosmology-tech/starship/compare/@starship-ci/[email protected]...@starship-ci/[email protected]) (2024-06-19)

**Note:** Version bump only for package @starship-ci/client
Expand Down
14 changes: 7 additions & 7 deletions clients/js/packages/client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ The `StarshipClient` simplifies managing Kubernetes resources, specifically tail
First, you need to import and initialize the `StarshipClient` with your Helm configuration:

```js
import { StarshipClient } from '@starship-ci/client';
import {StarshipClient} from '@starship-ci/client';

const client = new StarshipClient({
helmName: 'osmojs',
helmFile: 'path/to/config.yaml',
helmRepo: 'starship',
helmRepoUrl: 'https://cosmology-tech.github.io/starship/',
helmChart: 'devnet',
helmVersion: 'v0.2.3'
name: 'osmojs',
config: 'path/to/config.yaml',
repo: 'starship',
repoUrl: 'https://cosmology-tech.github.io/starship/',
chart: 'devnet',
version: 'v0.2.3'
});
```

Expand Down
Loading

0 comments on commit 15fa3b9

Please sign in to comment.