Skip to content

Commit

Permalink
Conduktor CLI initial commit
Browse files Browse the repository at this point in the history
Co-authored-by: LUC DUZAN <strokyl@users.noreply.github.com>
Co-authored-by: Thuillier Benjamin <benjaminthuillier@gmail.com>
Co-authored-by: Matt Searle <99.searle@gmail.com>
Co-authored-by: Quentin Boileau <qboileau@conduktor.io>
  • Loading branch information
4 people committed Mar 26, 2024
0 parents commit acc21c5
Show file tree
Hide file tree
Showing 37 changed files with 2,729 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export CDK_TOKEN=a
export CDK_BASE_URL=http://localhost:8080/api
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pkg/** linguist-generated
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG] My issue"
labels: triage
assignees: ''

---
Before submitting a bug report, please make sure that you are using the latest version of the CLI and read the [CONTRIBUTING.md](../../CONTRIBUTING.md#reporting-bugs) carefully.

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

**To Reproduce**
Steps to reproduce the behavior and manifests used.

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

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

**Desktop (please complete the following information):**
- OS/Arch: [e.g. MacOS M2, Linux x86_64, Windows]
- Version of CLI : [e.g. 0.1.0]
- Version of Console : [e.g. 1.22.0]
- CLI source : [e.g. Release binaries, Docker, Local build]

**Additional context**
Add any other context about the problem here.
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[FEAT] Feature request"
labels: triage
assignees: ''

---

Before submitting a feature request, please make sure that you are using the latest version of the CLI and read the [CONTRIBUTING.md](../../CONTRIBUTING.md#suggesting-enhancements) carefully.

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
68 changes: 68 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name-template: '$RESOLVED_VERSION'
tag-template: '$RESOLVED_VERSION'

version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: minor

categories:
- title: 'Features'
label: 'enhancement'
- title: 'Bug Fixes'
label: 'bug'
- title: 'Module updates'
label: 'module-upgrade'
- title: 'Dependency updates'
label: 'dependencies'

exclude-labels:
- 'skip'

autolabeler:
- label: 'module-upgrade'
title:
- '/\[Bump\].*\[version\]/'
branch:
- '/update_.+/'
- label: 'bug'
title:
- '/.*\[fix\].*/'
- label: 'patch'
title:
- '/.*\[fix\].*/'
- label: 'enhancement'
title:
- '/.*\[feat\].*/'
- label: 'minor'
title:
- '/.*\[feat\].*/'
- label: 'skip'
title:
- '/.*\[skip\].*/'
- label: 'major'
title:
- '/.*\[breaking\].*/'

replacers:
- search: '/\[feat\]/g'
replace: ''
- search: '/\[fix\]/g'
replace: ''
- search: '/\[skip\]/g'
replace: ''
- search: '/\[breaking\]/g'
replace: ''

template: |
# What's Changed
$CHANGES
77 changes: 77 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Build and Test

on:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize, labeled]

env:
GO_VERSION: 1.22.0

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref != format('refs/heads/{0}', 'main') }}

jobs:
update_release_draft:
runs-on: ubuntu-latest
if: ${{ github.ref == format('refs/heads/{0}', 'main') }}
steps:
- uses: release-drafter/release-drafter@v6.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: go test
run: go test ./...

integration-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: run test
run: ./test_final_exec.sh

docker-test:
runs-on: ubuntu-latest
env:
IMAGE_NAME: "conduktor-ctl"
PLATFORMS: "linux/amd64,linux/arm64"
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v3
with:
platforms: ${{ env.PLATFORMS }}

- uses: docker/setup-qemu-action@v3
with:
platforms: ${{ env.PLATFORMS }}

- uses: docker/metadata-action@v4
id: docker_meta
with:
images: conduktor/${{ env.IMAGE_NAME }}
tags: type=sha

- name: Build ${{ env.IMAGE_NAME }}
id: build
uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ env.PLATFORMS }}
push: false
file: docker/Dockerfile
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
github-token: ${{ secrets.GITHUB_TOKEN }}
build-args: |
hash=${{ github.sha }}
version=${{ github.ref_name }}
118 changes: 118 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Release
run-name: Release ${{ github.event.release.tag_name }} by ${{ github.actor }}

on:
release:
types: [published]

env:
GO_VERSION: 1.22.0

jobs:
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: go test
run: go test ./...

integration-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: run test
run: ./test_final_exec.sh

build-exec:
needs: [unit-test, integration-test]
runs-on: ubuntu-latest
strategy:
matrix:
# build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64
goos: [linux, windows, darwin]
goarch: [amd64, arm64]
steps:
- uses: actions/checkout@v4
- uses: wangyoucao577/go-release-action@v1.48
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: "${{ env.GO_VERSION }}"
ldflags: -X 'github.com/conduktor/ctl/cmd.version=${{ github.event.release.tag_name }}' -X 'github.com/conduktor/ctl/cmd.hash=${{ github.sha }}'
project_path: "./"
binary_name: "conduktor"

build-docker:
name: Build and publish conduktor-ctl image
needs: [unit-test, integration-test]
runs-on: ubuntu-latest
env:
IMAGE_NAME: "conduktor-ctl"
LABEL_IMAGE_TITLE: "Conduktor ctl"
LABEL_IMAGE_DESCRIPTION: "Conduktor command line tools"
LABEL_IMAGE_AUTHORS: "Conduktor <support@conduktor.io>"
LABEL_IMAGE_URL: "https://hub.docker.com/r/conduktor/conduktor-ctl"
LABEL_IMAGE_DOCUMENTATION: "https://docs.conduktor.io/conduktor"
LABEL_IMAGE_VENDOR: "Conduktor.io"
LABEL_IMAGE_LICENSE: "Apache-2.0"
PLATFORMS: "linux/amd64,linux/arm64"
steps:
- uses: actions/checkout@v3

- name: "Set latest"
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
latest_release_version=$(gh release view -R ${{ github.repository }} --json tagName -q .tagName)
is_latest=$(test "${{ github.event.release.tag_name }}" == "${latest_release_version}" && echo true || echo false)
echo "IS_LATEST=${is_latest}" >> $GITHUB_ENV
- uses: docker/setup-buildx-action@v3
with:
platforms: ${{ env.PLATFORMS }}

- uses: docker/setup-qemu-action@v3
with:
platforms: ${{ env.PLATFORMS }}

- uses: docker/login-action@v2
with:
username: ${{ secrets.CONDUKTORBOT_DOCKER_HUB_USERNAME }}
password: ${{ secrets.CONDUKTORBOT_DOCKER_HUB_PAT }}

- uses: docker/metadata-action@v4
id: docker_meta
with:
images: docker.io/conduktor/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ github.event.release.tag_name }}
type=raw,value=latest,enable=${{ env.IS_LATEST }}
labels: |
org.opencontainers.image.title=${{ env.LABEL_IMAGE_TITLE }}
org.opencontainers.image.description=${{ env.LABEL_IMAGE_DESCRIPTION }}
org.opencontainers.image.authors=${{ env.LABEL_IMAGE_AUTHORS }}
org.opencontainers.image.documentation=${{ env.LABEL_IMAGE_DOCUMENTATION }}
org.opencontainers.image.vendor=${{ env.LABEL_IMAGE_VENDOR }}
org.opencontainers.image.licenses=${{ env.LABEL_IMAGE_LICENSE }}
org.opencontainers.image.url=${{ env.LABEL_IMAGE_URL }}
org.opencontainers.image.version=${{ github.event.release.tag_name }}
- name: Build ${{ env.IMAGE_NAME }}
id: build
uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ env.PLATFORMS }}
push: ${{ github.event.release.prerelease == false }} # only push on final release
file: docker/Dockerfile
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
github-token: ${{ secrets.GITHUB_TOKEN }}
build-args: |
hash=${{ github.sha }}
version=${{ github.event.release.tag_name }}
Loading

0 comments on commit acc21c5

Please sign in to comment.