Skip to content

Commit

Permalink
Odin cli interface (#51)
Browse files Browse the repository at this point in the history
* internal module for artifact file parsing

* refer component dir from cli args

* update module dependencies

* shell executor package

* maven parser package

* change property name

* parse property file

* change post step name

* generate artifact

* initiate commands

* import commands from catalog

* update dependecnies

* add description

* add publish command and remove test command

* publish function as command

* clean main caller

* update dependencies

* change logger

* add argument validations

* logging handler package

* fetch properties based on artifact flavour

* call logging handler

* create file package

* create artifact assets

* create dockerfile for component

* logging changes

* return exit code from command output

* update dependencies

* add application port

* add docker build step

* package for docker

* update dependencies

* change tagging

* change dockerfile steps

* create artifact tag

* change dockerfile steps

* add descriptions

* cli handler package

* add hidden test command

* import cli handler

* add description

* add todo

* define todod

* revert: flags

* initiate env command

* segregate env+create+destroy

* added: commands for profile deploy and delete

* refactor deploy+destroy segregation

* packahe for dir handeling

* profile command

* change uninstall command

* initiate api structures for profile+service+component

* dir exists functionality

* versioned structure

* fetch workdir form structure

* add create dir functionality

* core structure support

* set application properties in d11cli package

* set logging

* add flag support

* rectify test help

* define flag parse behaviour

* remove unused code

* Chore(flags): Add/Enhance command flags (#2)

* get values from flags

* add flags as option in help

* move initialization to application package

* get values from flags

* enhance help section

* fix flag name in errors

* change command format to verb+resource+option (#3)

* Update readme (#4)

* d11-cli -> odin (#5)

* odin face

* odin face

* Update readme

* Update readme

* Update readme

* escape editor files in git ignore

* Fix: Logging library (#6)

* Remove external logger and use cli.Ui

* ui/Interface() -> commandline/Interface

* update readme

* add: verbs and makefile (#7)

* Update issue templates

* Update issue templates

* Backend API integration (#8)

* feat: base structure for backend apis

* feat: error response structure

* feat: infra creation-response structure

* feat: infra creation api response

* feat: infra creation command, parse creation response

* feat: delete profile command

* feat: deploy service api

* feat: service creation call api

* feat: profile creation call api

* fix: change crofile details input type

* fix: lint

* fix: invalid command error code

* feat: list service structure

* fix: table formatting

* fix: prevent empty query and header params

* feat: parse service list response and display

* fix: handle table formation error

* fix: maturity param

* fix: append / with services post call

* fix: change request content type

* fix: remove json conversion of parsed service

* chore: remove todo comments

* fix: append / with services delete call

* fix: append / with services label mature call

* chore: remove out-of-scope commands

* fix: response structure for api support

* fix: change parsing fields

* fix: change return response and append / to infra post api

* fix: add name field

* fix: change infra create help options

* feat: list infra response structure

* fix: parse infra list response

* feat: list infra table view

* feat: new resource verb

* feat: infra update command

* feat: update infra command

* feat: update infra api

* fix: explain infra

* feat: deacribe infra api

* feat: describe infra view

* fix: lint

* fix: add detailed keys

* feat: component structure

* feat: describe service api

* fix: service apis

* fix: parameter validations

* feat: component structure

* feat: componet list api

* feat: empty parameter validator

* fix: use empty parameter validator

* feat: list component type command

* feat: service deploy command

* feat: service deploy api

* fix: use genric infra structure

* chore: remove unused module imports

* fix: auth urls

* chore: remove todos

* fix: component type interface

* fix: mark interface

* chore: remove unused commands & add todos

* fix: authorization header

* chore: descriptions and linting

* fix: multi refresh tokens

* chore: update readme

* fix: use cli args to parse flags

* chore: move sample commands to comments

* fix: add component type label in list components

* chore: change componet list label

* fix: config load on compile

* fix: pre write secure config

* chore: change log level

* feat: detailed view of list opration

* Fix: service output in infra description (#11)

* fix: change service struct

* fix:lint

* Feat: [pre-commit] sanity checks and linters (#12)

* fix: linting (#13)

* feat: add PR sanity checks (#14)

* Feat/release (#15)

* feat: binary release directory

* feat: build binaries command

* chore: update all dependencies

* fix: remove go get command

* feat: file to return app version

* feat: add version format and management

* feat: add version upgrade note

* fix: create only darwin artifact

* feat: release github actions

* Feat/release (#16)

* feat: binary release directory

* feat: build binaries command

* chore: update all dependencies

* fix: remove go get command

* feat: file to return app version

* feat: add version format and management

* feat: add version upgrade note

* fix: create only darwin artifact

* feat: release github actions

* fix: change action runner

* Feat/release (#17)

* feat: binary release directory

* feat: build binaries command

* chore: update all dependencies

* fix: remove go get command

* feat: file to return app version

* feat: add version format and management

* feat: add version upgrade note

* fix: create only darwin artifact

* feat: release github actions

* fix: change action runner

* fix: version name

* Feat/release (#18)

* feat: binary release directory

* feat: build binaries command

* chore: update all dependencies

* fix: remove go get command

* feat: file to return app version

* feat: add version format and management

* feat: add version upgrade note

* fix: create only darwin artifact

* feat: release github actions

* fix: change action runner

* fix: version name

* fix: remove changelog step

* fix: install go before build

* Fix: release workflow (#19)

* fix: publish release only on main merge

* fix: remove commit details

* Fix: cosmetic changes (#22)

* fix: change infra resource to env

* fix: service reference infra as env

* fix: infra -> env command name

* chore: clean todos

* fix: readme lint

* fix: bin reference command

* chore: add support for more arch builds

* chore: remove (unused) profile command file

* Feat: infra -> env (#23)

* feat: Moving from infra to env

* Adding changes for env

* Adding env create changes

* changing help

* Command output changed

* Reverting infra changes

* Changing from i to e

* Adding the default env_type as kube

* fix: unexport param vars

Co-authored-by: Shobhit <[email protected]>

* feat: service rebuild, describe, list, schema changes (#20)

* feat: service rebuild, describe, list, schema changes

* chore: log response as error for 400, 500 status code

* chore: allow filtering by version in list service api

* chore: refactor list service command

* chore: change urls to v2

* chore: change response of service describe

* Making team env purpose as optional

* Addressing comment

* chore: update readme (#25)

* chore: update readme

* chore: update readme

* odin deployment jenkinsfile

* load-1304 created from local by subhash

* load-1304 created from local by subhash

* odin deployment jenkinsfile

* Status command for service status (#27)

* feat: status command for service

* chore: modify according to new status api response format

* fix: type in synopsis

* chore: service label command

* chore: service delete command (#29)

Co-authored-by: Shobhit <[email protected]>

* fix: use *bool instead of bool in struct (#30)

* Adding list and describe env changes

* Adding filter support

* adding name filter

* Moving purpose at the end

* Adding service and component support

* Adding changes

* uppercase

* Comments changes

* Adding service version to versions

* Comments addressed

* chore: output commands to run next (#32)

* chore: output commands to run next

* chore: refactor next command output

* Changing output for next command

* Component and Component Type Command (#31)

* chore: add component-type command in catalog

* feat: component type list and describe

* fix: dereference mature in list service response

* chore: next command in output

* feat: describe component command

* chore: rename component-type file to componentType

* chore: separate component type and component

* chore: update next command for list component-type

* chore: change in response

* chore: rebase with development

* Added env status command (#35)

* Added env status command

* Update env.go

* Formatted the command.env file

* Added formatting for all files

* Updated variables

* Bug resolve

* fix: component type synopsis message (#38)

* Commands for Environment History (#34)

* command added: odin get-history env

* command added: describe-history env

* syntax update

* set id flag as int

* removing unused flag

* minor change

* get-history output update

* Added: DateTime module for time difference (#36)

* added: relative date time support

* fix: format

* minor change

* updated: datetime package to support auto deletion time

* minor changes

Co-authored-by: Harshit Sharma <[email protected]>

Co-authored-by: Harshit Sharma <[email protected]>

* Adding service remove

* Adding change

* Changing log message

* Adding rebuild and force flag for service deploy

* Reviewing comments

* Refactor service describe (#39)

* feat: merge describe component in describe service

* chore: add created/updated columns in odin list env

* chore: refactor describe service output

Signed-off-by: Akshay Patidar <[email protected]>

* chore: add next command in rebuild as well

* Addressing comments

* feat: improve error message for empty params (#42)

* feat: improve error message for empty params

* chore: improve error mesasge for env commands

* chore: prepend -- to flag names

* Changing error message

* Added env status (#43)

* Changing logger method

* Adding debug for 400 status

* Adding debug

* feat: change version to alpha for alpha release of cli

* Feat: release (#47)

* feat: binary release directory

* feat: build binaries command

* chore: update all dependencies

* fix: remove go get command

* feat: file to return app version

* feat: add version format and management

* feat: add version upgrade note

* fix: create only darwin artifact

* feat: release github actions

* fix: change action runner

* fix: version name

* fix: remove changelog step

* fix: install go before build

* feat: build system specific binaries

* feat: make compressed tar of builds

* feat: release

* chore: change tar location

Co-authored-by: Harshit Sharma <[email protected]>

* fix: release base branch

* fix: release message (#48)

* Fix: release (#49)

* fix: release message

* fix: sha

* fix: tar (#50)

* fix: change ref branch for release action

* feat: brew installation steps

* feat: PR template

* feat: PR template

* fix: pr template path

Co-authored-by: Harshit Sharma <[email protected]>
Co-authored-by: Swapnesh Kumar <[email protected]>
Co-authored-by: Shobhit <[email protected]>
Co-authored-by: Akshay Patidar <[email protected]>
Co-authored-by: Shobhit <[email protected]>
Co-authored-by: subhash.kumar <[email protected]>
Co-authored-by: dhavalmehta07 <[email protected]>
Co-authored-by: Swapnesh Kumar <[email protected]>
Co-authored-by: Pawan Tejwani <[email protected]>
  • Loading branch information
10 people authored Feb 1, 2022
1 parent ef4aed7 commit 44b3b30
Show file tree
Hide file tree
Showing 50 changed files with 4,471 additions and 3 deletions.
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG]"
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/help-topic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Help Topic
about: Describe this issue template's purpose here.
title: HELP!!!
labels: help wanted
assignees: ''

---

**Description**
A clear and concise description of the topic with which you want help.

**Additional information**
Add any other context about the query here.
8 changes: 8 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Odin version(x.y.z)
<!-- Make sure to update the Odin's version at ./app/app.go and add the same version above -->

## Features
<!-- Add what this PR brings in as features -->

## Resources
<!-- Add any more resources that are required with this PR -->
19 changes: 19 additions & 0 deletions .github/workflows/go-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: golangci-lint
on:
pull_request:
branches:
- main
- development
permissions:
contents: read
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.43.0
args: -E gofmt -E gci
64 changes: 64 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: odin-release
on:
pull_request:
types: [closed]
jobs:
release:
name: odin-release
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v2
- id: changed_files
uses: jitterbit/get-changed-files@v1
- name: Check commit details
id: commit
run: |
echo "::set-output name=version::$(go run cmd/getVersion.go)"
echo "::set-output name=changelog::$(git log --pretty='- %s')"
- name: Create Tag
uses: negz/create-tag@v1
with:
version: ${{ steps.commit.outputs.version }}
message: ${{ steps.commit.outputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-go@v2
with:
go-version: '1.17.1'
- name: Create Release Asset
run: |
make compressed-builds
- name: Generate Asset SHA256
id: sha256
run: |
echo "::set-output name=darwin_amd64::$(shasum -a 256 bin/odin_darwin_amd64.tar.gz | cut -d' ' -f1)"
echo "::set-output name=darwin_arm64::$(shasum -a 256 bin/odin_darwin_arm64.tar.gz | cut -d' ' -f1)"
echo "::set-output name=linux_amd64::$(shasum -a 256 bin/odin_linux_amd64.tar.gz | cut -d' ' -f1)"
- name: Create Release
uses: ncipollo/release-action@v1
with:
name: Release ${{ steps.commit.outputs.version }}
tag: ${{ steps.commit.outputs.version }}
artifacts: "bin/*.tar.gz"
body: |
### Changelog:
${{ steps.commit.outputs.changelog }}
---
### Assets
#### Darwin AMD64
- Asset Url: https://github.com/dream11/odin/releases/download/${{ steps.commit.outputs.version }}/odin_darwin_amd64.tar.gz
- SHA Checksum: `${{ steps.sha256.outputs.darwin_amd64 }}`
#### Darwin ARM64
- Asset Url: https://github.com/dream11/odin/releases/download/${{ steps.commit.outputs.version }}/odin_darwin_arm64.tar.gz
- SHA Checksum: `${{ steps.sha256.outputs.darwin_arm64 }}`
#### Linux AMD64
- Asset Url: https://github.com/dream11/odin/releases/download/${{ steps.commit.outputs.version }}/odin_linux_amd64.tar.gz
- SHA Checksum: `${{ steps.sha256.outputs.linux_amd64 }}`
token: ${{ secrets.GITHUB_TOKEN }}
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,13 @@
*.out

# Dependency directories (remove the comment below to include it)
bin
# vendor/

# Editor files
*.code-workspace
*.idea/

# Service definition files
service.yaml
service.json
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
repos:
- repo: git://github.com/golangci/golangci-lint
rev: v1.43.0
hooks:
- id: golangci-lint
name: golangci-lint
description: Fast linters runner for Go.
entry: golangci-lint run -E gofmt -E gci --fix
types: [ go ]
language: golang
pass_filenames: false
36 changes: 36 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* groovylint-disable DuplicateStringLiteral, LineLength, NestedBlockDepth, ParameterCount */
@Library('d11-jenkins-lib@master') _
pipeline {
agent {
label "devx-auto"
}

options {
ansiColor('xterm')
}

stages {
stage('CheckoutCode') {
steps {
script {
cleanWs()
checkout scm
}
}
}

stage('Installation') {
steps {
script {
sh """
make install
go build .
sudo mv ./odin /usr/local/bin
odin --version
"""
}
}
}
}
}

22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
install:
go mod download
go build .
sudo mv ./odin /usr/local/bin
odin --version

lint:
golangci-lint run -E gofmt -E gci --fix;

build:
go mod download
mkdir -p bin/odin_darwin_amd64
env GOOS=darwin GOARCH=amd64 go build -o bin/odin_darwin_amd64/odin
mkdir -p bin/odin_darwin_arm64
env GOOS=darwin GOARCH=arm64 go build -o bin/odin_darwin_arm64/odin
mkdir -p bin/odin_linux_amd64
env GOOS=linux GOARCH=amd64 go build -o bin/odin_linux_amd64/odin

compressed-builds: build
cd bin/odin_darwin_amd64 && tar -czvf ../odin_darwin_amd64.tar.gz odin
cd bin/odin_darwin_arm64 && tar -czvf ../odin_darwin_arm64.tar.gz odin
cd bin/odin_linux_amd64 && tar -czvf ../odin_linux_amd64.tar.gz odin
Loading

0 comments on commit 44b3b30

Please sign in to comment.