From b294bd682a9b5bc4f0c274ff6e95f7c1d5f76643 Mon Sep 17 00:00:00 2001 From: John Dietz Date: Mon, 7 Oct 2024 16:39:39 -0400 Subject: [PATCH] add ci for adoption of mgmt-24 --- .argo/publish.yaml | 71 ++++++++++--- .argo/release.yaml | 151 +++++++++++++++++----------- .argo/{deploy.yaml => staging.yaml} | 35 +++---- .argo/trigger.yaml | 39 +++++++ .github/workflows/main.yaml | 142 +++----------------------- .github/workflows/release.yaml | 34 +++++++ .github/workflows/staging.yaml | 35 +++++++ .github/workflows/trigger.yaml | 32 ++++++ package.json | 2 +- 9 files changed, 324 insertions(+), 217 deletions(-) rename .argo/{deploy.yaml => staging.yaml} (65%) create mode 100644 .argo/trigger.yaml create mode 100644 .github/workflows/release.yaml create mode 100644 .github/workflows/staging.yaml create mode 100644 .github/workflows/trigger.yaml diff --git a/.argo/publish.yaml b/.argo/publish.yaml index feab50f..0706c9e 100644 --- a/.argo/publish.yaml +++ b/.argo/publish.yaml @@ -10,7 +10,7 @@ spec: steps: - - name: publish-container templateRef: - name: cwft-kaniko + name: cwft-kaniko-v2 template: build-push clusterScope: true arguments: @@ -23,9 +23,10 @@ spec: value: '{{workflow.parameters.containerRegistryURL}}' - name: gitUrlNoProtocol value: '{{workflow.parameters.gitUrlNoProtocol}}' - - - name: checkout + + - - name: checkout-repos templateRef: - name: cwft-git + name: cwft-git-v2 template: checkout-with-gitops clusterScope: true arguments: @@ -36,49 +37,91 @@ spec: value: '{{workflow.parameters.branch}}' - name: gitUrlNoProtocol value: '{{workflow.parameters.gitUrlNoProtocol}}' - - - name: get-initial-chart-version + + - - name: get-initial-micro-chart-version templateRef: - name: cwft-helm + name: cwft-helm-v2 template: get-chart-version clusterScope: true arguments: artifacts: - name: repo-source - from: '{{steps.checkout.outputs.artifacts.repo-source}}' + from: '{{steps.checkout-repos.outputs.artifacts.repo-source}}' parameters: - name: appName value: '{{workflow.parameters.appName}}' - name: chartDir value: 'charts/{{workflow.parameters.appName}}' - - - name: set-chart-versions + + - - name: set-micro-chart-versions templateRef: - name: cwft-helm - template: set-chart-versions + name: cwft-helm-v2 + template: set-micro-chart-versions clusterScope: true arguments: artifacts: - name: repo-source - from: '{{steps.checkout.outputs.artifacts.repo-source}}' + from: '{{steps.checkout-repos.outputs.artifacts.repo-source}}' parameters: - name: appName value: '{{workflow.parameters.appName}}' - name: chartDir value: 'charts/{{workflow.parameters.appName}}' - name: chartVersion - value: '{{steps.get-initial-chart-version.outputs.result}}-rc.{{workflow.parameters.shortSha}}' + value: '{{steps.get-initial-micro-chart-version.outputs.result}}-rc.{{workflow.parameters.shortSha}}' - name: shortSha value: '{{workflow.parameters.shortSha}}' - - - name: publish-helm-chart + + - - name: publish-micro-helm-chart templateRef: - name: cwft-helm + name: cwft-helm-v2 template: publish-chart clusterScope: true arguments: artifacts: - name: repo-source - from: '{{steps.set-chart-versions.outputs.artifacts.repo-source}}' + from: '{{steps.set-micro-chart-versions.outputs.artifacts.repo-source}}' parameters: - name: appName value: '{{workflow.parameters.appName}}' - name: chartDir value: 'charts/{{workflow.parameters.appName}}' + + - - name: set-environment-version-for-macro-chart + templateRef: + name: cwft-helm-v2 + template: set-environment-version-for-macro-chart + clusterScope: true + arguments: + artifacts: + - name: repo-source + from: '{{steps.set-micro-chart-versions.outputs.artifacts.repo-source}}' + parameters: + - name: fullChartPath + value: '{{workflow.parameters.gitopsDestinationFile}}' + - name: chartVersion + value: '{{steps.get-initial-micro-chart-version.outputs.result}}-rc.{{workflow.parameters.shortSha}}' + - name: environment + value: '{{workflow.parameters.environment}}' + + - - name: commit-micro-chart-increment + templateRef: + name: cwft-git-v2 + template: pull-commit-sign-push + clusterScope: true + arguments: + artifacts: + - name: repo-source + from: '{{steps.set-environment-version-for-macro-chart.outputs.artifacts.repo-source}}' + parameters: + - name: repoName + value: 'gitops' + - name: gitUrlNoProtocol + value: '{{workflow.parameters.gitUrlNoProtocol}}' + - name: commitMessage + # Please, be careful updating this message, it must comply with: + # github skip ci rule: https://github.blog/changelog/2021-02-08-github-actions-skip-pull-request-and-push-workflows-with-skip-ci/ + # github skip ci rule: https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs + # gitlab skip ci rule: https://devops.stackexchange.com/questions/6809/is-there-a-ci-skip-option-in-gitlab-ci + # in case, the rule is disbaled or don't work this step will create a circular trigger of builds and bumps of version. + value: "[skip ci] [CI SKIP] setting {{workflow.parameters.appName}} {{workflow.parameters.environment}} to chart version '{{steps.get-initial-micro-chart-version.outputs.result}}-rc.{{workflow.parameters.shortSha}}'\n\nskip-checks:true" diff --git a/.argo/release.yaml b/.argo/release.yaml index cca2afd..58b96d0 100644 --- a/.argo/release.yaml +++ b/.argo/release.yaml @@ -6,9 +6,10 @@ spec: templates: - name: main steps: + - - name: checkout templateRef: - name: cwft-git + name: cwft-git-v2 template: checkout-with-gitops clusterScope: true arguments: @@ -19,9 +20,10 @@ spec: value: '{{workflow.parameters.branch}}' - name: gitUrlNoProtocol value: '{{workflow.parameters.gitUrlNoProtocol}}' - - - name: get-initial-chart-version + + - - name: get-semver-chart-version templateRef: - name: cwft-helm + name: cwft-helm-v2 template: get-chart-version clusterScope: true arguments: @@ -33,109 +35,110 @@ spec: value: '{{workflow.parameters.appName}}' - name: chartDir value: 'charts/{{workflow.parameters.appName}}' - - - name: set-chart-versions + + - - name: get-chart-version templateRef: - name: cwft-helm - template: set-chart-versions + name: cwft-helm-v2 + template: get-macro-chart-version-from-gitops-repo clusterScope: true arguments: artifacts: - name: repo-source from: '{{steps.checkout.outputs.artifacts.repo-source}}' parameters: - - name: appName - value: '{{workflow.parameters.appName}}' - - name: chartDir - value: 'charts/{{workflow.parameters.appName}}' - - name: chartVersion - value: '{{steps.get-initial-chart-version.outputs.result}}' - - name: shortSha - value: '{{workflow.parameters.shortSha}}' - - - name: publish-helm-chart + - name: gitopsSourceFile + value: '{{workflow.parameters.gitopsSourceFile}}' + + - - name: get-shortsha-from-rc templateRef: - name: cwft-helm - template: publish-chart + name: cwft-helm-v2 + template: get-shortsha-from-rc clusterScope: true arguments: artifacts: - name: repo-source - from: '{{steps.set-chart-versions.outputs.artifacts.repo-source}}' + from: '{{steps.checkout.outputs.artifacts.repo-source}}' parameters: - - name: appName - value: '{{workflow.parameters.appName}}' - - name: chartDir - value: 'charts/{{workflow.parameters.appName}}' - - - name: set-environment-version + - name: rcVersion + value: '{{steps.get-chart-version.outputs.result}}' + + - - name: set-micro-chart-versions templateRef: - name: cwft-helm - template: set-environment-version + name: cwft-helm-v2 + template: set-micro-chart-versions clusterScope: true arguments: artifacts: - name: repo-source from: '{{steps.checkout.outputs.artifacts.repo-source}}' parameters: - - name: fullChartPath - value: 'registry/{{workflow.parameters.clusterName}}/components/{{workflow.parameters.environment}}/{{workflow.parameters.appName}}/Chart.yaml' + - name: appName + value: '{{workflow.parameters.appName}}' + - name: chartDir + value: 'charts/{{workflow.parameters.appName}}' - name: chartVersion - value: '{{steps.get-initial-chart-version.outputs.result}}' - - name: environment - value: '{{workflow.parameters.environment}}' - - - name: commit-production + value: '{{steps.get-semver-chart-version.outputs.result}}' + - name: shortSha + value: '{{steps.get-shortsha-from-rc.outputs.result}}' + + - - name: publish-micro-helm-chart templateRef: - name: cwft-git - template: pull-commit-push + name: cwft-helm-v2 + template: publish-chart clusterScope: true arguments: artifacts: - name: repo-source - from: '{{steps.set-environment-version.outputs.artifacts.repo-source}}' + from: '{{steps.set-micro-chart-versions.outputs.artifacts.repo-source}}' parameters: - - name: repoName - value: 'gitops' - - name: gitUrlNoProtocol - value: '{{workflow.parameters.gitUrlNoProtocol}}' - - name: commitMessage - value: 'setting {{workflow.parameters.appName}} {{workflow.parameters.environment}} to chart version {{steps.get-initial-chart-version.outputs.result}}' - - - name: increment-chart-minor + - name: appName + value: '{{workflow.parameters.appName}}' + - name: chartDir + value: 'charts/{{workflow.parameters.appName}}' + + - - name: release-and-tag-main-with-notes templateRef: - name: cwft-helm - template: increment-chart-minor + name: cwft-git-v2 + template: release-and-tag-main-with-notes clusterScope: true arguments: artifacts: - name: repo-source - from: '{{steps.set-environment-version.outputs.artifacts.repo-source}}' + from: '{{steps.set-micro-chart-versions.outputs.artifacts.repo-source}}' parameters: + - name: orgName + value: 'konstructio' - name: appName value: '{{workflow.parameters.appName}}' - - name: chartDir - value: 'charts/{{workflow.parameters.appName}}' - - name: chartVersion - value: '{{steps.get-initial-chart-version.outputs.result}}' - - - name: get-published-chart-version + - name: tagName + value: '{{steps.get-semver-chart-version.outputs.result}}' + + - - name: increment-micro-chart-minor templateRef: - name: cwft-helm - template: get-chart-version + name: cwft-helm-v2 + template: increment-chart-minor clusterScope: true arguments: artifacts: - name: repo-source - from: '{{steps.increment-chart-minor.outputs.artifacts.repo-source}}' + from: '{{steps.set-micro-chart-versions.outputs.artifacts.repo-source}}' parameters: - name: appName value: '{{workflow.parameters.appName}}' - name: chartDir value: 'charts/{{workflow.parameters.appName}}' - - - name: commit-chart-increment + - name: chartVersion + value: '{{steps.get-chart-version.outputs.result}}' + + - - name: commit-micro-chart-increment templateRef: - name: cwft-git - template: pull-commit-push + name: cwft-git-v2 + template: pull-commit-sign-push clusterScope: true arguments: artifacts: - name: repo-source - from: '{{steps.increment-chart-minor.outputs.artifacts.repo-source}}' + from: '{{steps.increment-micro-chart-minor.outputs.artifacts.repo-source}}' parameters: - name: repoName value: '{{workflow.parameters.appName}}' @@ -147,4 +150,38 @@ spec: # github skip ci rule: https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs # gitlab skip ci rule: https://devops.stackexchange.com/questions/6809/is-there-a-ci-skip-option-in-gitlab-ci # in case, the rule is disbaled or don't work this step will create a circular trigger of builds and bumps of version. - value: "[skip ci] [CI SKIP] setting {{workflow.parameters.appName}} {{workflow.parameters.environment}} to chart version {{steps.get-published-chart-version.outputs.result}}\n\nskip-checks:true" + value: "[skip ci] [CI SKIP] bumping {{workflow.parameters.appName}} {{workflow.parameters.environment}} minor version\n\nskip-checks:true" + + - - name: set-environment-version + templateRef: + name: cwft-helm-v2 + template: set-environment-version-for-macro-chart + clusterScope: true + arguments: + artifacts: + - name: repo-source + from: '{{steps.checkout.outputs.artifacts.repo-source}}' + parameters: + - name: fullChartPath + value: '{{workflow.parameters.gitopsDestinationFile}}' + - name: chartVersion + value: '{{steps.get-semver-chart-version.outputs.result}}' + - name: environment + value: '{{workflow.parameters.environment}}' + + - - name: commit + templateRef: + name: cwft-git-v2 + template: pull-commit-sign-push + clusterScope: true + arguments: + artifacts: + - name: repo-source + from: '{{steps.set-environment-version.outputs.artifacts.repo-source}}' + parameters: + - name: repoName + value: 'gitops' + - name: gitUrlNoProtocol + value: '{{workflow.parameters.gitUrlNoProtocol}}' + - name: commitMessage + value: 'setting {{workflow.parameters.appName}} {{workflow.parameters.environment}} to chart version {{steps.get-semver-chart-version.outputs.result}}' diff --git a/.argo/deploy.yaml b/.argo/staging.yaml similarity index 65% rename from .argo/deploy.yaml rename to .argo/staging.yaml index ee4fa87..653576b 100644 --- a/.argo/deploy.yaml +++ b/.argo/staging.yaml @@ -10,7 +10,7 @@ spec: steps: - - name: checkout templateRef: - name: cwft-git + name: cwft-git-v2 template: checkout-with-gitops clusterScope: true arguments: @@ -21,24 +21,24 @@ spec: value: '{{workflow.parameters.branch}}' - name: gitUrlNoProtocol value: '{{workflow.parameters.gitUrlNoProtocol}}' - - - name: get-initial-chart-version + + - - name: get-chart-version templateRef: - name: cwft-helm - template: get-chart-version + name: cwft-helm-v2 + template: get-macro-chart-version-from-gitops-repo clusterScope: true arguments: artifacts: - name: repo-source from: '{{steps.checkout.outputs.artifacts.repo-source}}' parameters: - - name: appName - value: '{{workflow.parameters.appName}}' - - name: chartDir - value: 'charts/{{workflow.parameters.appName}}' - - - name: set-environment-version + - name: gitopsSourceFile + value: '{{workflow.parameters.gitopsSourceFile}}' + + - - name: set-environment-version-for-macro-chart templateRef: - name: cwft-helm - template: set-environment-version + name: cwft-helm-v2 + template: set-environment-version-for-macro-chart clusterScope: true arguments: artifacts: @@ -46,24 +46,25 @@ spec: from: '{{steps.checkout.outputs.artifacts.repo-source}}' parameters: - name: fullChartPath - value: 'registry/{{workflow.parameters.clusterName}}/components/{{workflow.parameters.environment}}/{{workflow.parameters.appName}}/Chart.yaml' + value: '{{workflow.parameters.gitopsDestinationFile}}' - name: chartVersion - value: '{{steps.get-initial-chart-version.outputs.result}}-rc.{{workflow.parameters.shortSha}}' + value: '{{steps.get-chart-version.outputs.result}}' - name: environment value: '{{workflow.parameters.environment}}' + - - name: commit templateRef: - name: cwft-git - template: pull-commit-push + name: cwft-git-v2 + template: pull-commit-sign-push clusterScope: true arguments: artifacts: - name: repo-source - from: '{{steps.set-environment-version.outputs.artifacts.repo-source}}' + from: '{{steps.set-environment-version-for-macro-chart.outputs.artifacts.repo-source}}' parameters: - name: repoName value: 'gitops' - name: gitUrlNoProtocol value: '{{workflow.parameters.gitUrlNoProtocol}}' - name: commitMessage - value: 'setting {{workflow.parameters.appName}} {{workflow.parameters.environment}} to chart version {{steps.get-initial-chart-version.outputs.result}}-rc.{{workflow.parameters.shortSha}}' + value: 'setting {{workflow.parameters.appName}} {{workflow.parameters.environment}} to chart version {{steps.get-chart-version.outputs.result}}' diff --git a/.argo/trigger.yaml b/.argo/trigger.yaml new file mode 100644 index 0000000..1cf5fa5 --- /dev/null +++ b/.argo/trigger.yaml @@ -0,0 +1,39 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Workflow +metadata: + namespace: argo +spec: + entrypoint: main + serviceAccountName: argo-server + templates: + - name: main + steps: + - - name: checkout-repos + templateRef: + name: cwft-git-v2 + template: checkout-with-gitops + clusterScope: true + arguments: + parameters: + - name: appName + value: '{{workflow.parameters.appName}}' + - name: branch + value: '{{workflow.parameters.branch}}' + - name: gitUrlNoProtocol + value: '{{workflow.parameters.gitUrlNoProtocol}}' + - - name: pull-commit-empty-push + templateRef: + name: cwft-git-v2 + template: pull-commit-empty-push + clusterScope: true + arguments: + artifacts: + - name: repo-source + from: '{{steps.checkout-repos.outputs.artifacts.repo-source}}' + parameters: + - name: commitMessage + value: 'chore: triggered an empty commit against main branch' + - name: gitUrlNoProtocol + value: '{{workflow.parameters.gitUrlNoProtocol}}' + - name: repoName + value: '{{workflow.parameters.appName}}' diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index e2f4b9a..907eee0 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -1,8 +1,11 @@ -name: release +name: main env: ARGO_NAMESPACE: argo ARGO_VERSION: v3.4.1 - CONTAINER_REGISTRY_URL: 'public.ecr.aws/kubefirst' + +permissions: + packages: write + contents: read on: push: branches: @@ -11,9 +14,12 @@ jobs: publish: runs-on: self-hosted steps: - - name: Setup Runner for Argo + - name: checkout repository + uses: actions/checkout@v4 + - name: inject slug/short variables + uses: rlespinasse/github-slug-action@v4 + - name: publish image and chart run: | - cd $HOME echo "Install argo" # Download the binary curl -sLO https://github.com/argoproj/argo-workflows/releases/download/${ARGO_VERSION}/argo-linux-amd64.gz @@ -21,135 +27,15 @@ jobs: gunzip argo-linux-amd64.gz # Make binary executable chmod +x argo-linux-amd64 - # Move binary to path - sudo mv ./argo-linux-amd64 /usr/local/bin/argo - # Test installation - - name: Check out repository code - uses: actions/checkout@v3 - - name: Inject slug/short variables - uses: rlespinasse/github-slug-action@v4 - - run: echo ${GITHUB_REPOSITORY} - - run: echo ${GITHUB_REPOSITORY_NAME_PART} - - run: echo ${GITHUB_SERVER_URL} - - name: publish - run: | echo "commit sha ${GITHUB_SHA}" - argo version --short - argo submit .argo/publish.yaml \ + ./argo-linux-amd64 version --short + ./argo-linux-amd64 submit .argo/publish.yaml \ --generate-name="${GITHUB_REPOSITORY_NAME_PART}-publish-${GITHUB_SHA_SHORT}-" \ -p appName="${GITHUB_REPOSITORY_NAME_PART}" \ -p branch="${GITHUB_REF_NAME}" \ - -p containerRegistryURL="${CONTAINER_REGISTRY_URL}/${GITHUB_REPOSITORY_NAME_PART}:${GITHUB_SHA_SHORT}" \ - -p gitUrlNoProtocol="git@github.com:${GITHUB_REPOSITORY_OWNER_PART_SLUG}" \ - -p shortSha="${GITHUB_SHA_SHORT}" \ - --wait --log - - run: echo "⭐️ the kubefirst open source platform is powered by github stars. give kubefirst one today https://github.com/kubefirst/kubefirst" - development: - needs: publish - runs-on: self-hosted - steps: - - name: Setup Runner for Argo - run: | - cd $HOME - echo "Install argo" - # Download the binary - curl -sLO https://github.com/argoproj/argo-workflows/releases/download/${ARGO_VERSION}/argo-linux-amd64.gz - # Unzip - gunzip argo-linux-amd64.gz - # Make binary executable - chmod +x argo-linux-amd64 - # Move binary to path - sudo mv ./argo-linux-amd64 /usr/local/bin/argo - # Test installation - argo version --short - - name: Check out repository code - uses: actions/checkout@v3 - - name: Inject slug/short variables - uses: rlespinasse/github-slug-action@v4 - - name: development - run: | - echo "commit sha $GITHUB_SHA" - argo version --short - argo submit .argo/deploy.yaml \ - --generate-name="${GITHUB_REPOSITORY_NAME_PART}-development-${GITHUB_SHA_SHORT}-" \ - -p appName="${GITHUB_REPOSITORY_NAME_PART}" \ - -p branch="${GITHUB_REF_NAME}" \ - -p clusterName="mgmt-20-kubefirst-com" \ -p environment="development" \ + -p containerRegistryURL="ghcr.io/konstructio/${GITHUB_REPOSITORY_NAME_PART}:${GITHUB_SHA_SHORT}" \ -p gitUrlNoProtocol="git@github.com:${GITHUB_REPOSITORY_OWNER_PART_SLUG}" \ -p shortSha="${GITHUB_SHA_SHORT}" \ + -p gitopsDestinationFile="registry/environments/development/flappy-kray.yaml" \ --wait --log - - run: echo "⭐️ the kubefirst open source platform is powered by github stars. give kubefirst one today https://github.com/kubefirst/kubefirst" - staging: - needs: development - runs-on: self-hosted - steps: - - name: Setup Runner for Argo - run: | - cd $HOME - echo "Install argo" - # Download the binary - curl -sLO https://github.com/argoproj/argo-workflows/releases/download/${ARGO_VERSION}/argo-linux-amd64.gz - # Unzip - gunzip argo-linux-amd64.gz - # Make binary executable - chmod +x argo-linux-amd64 - # Move binary to path - sudo mv ./argo-linux-amd64 /usr/local/bin/argo - # Test installation - argo version --short - - name: Check out repository code - uses: actions/checkout@v3 - - name: Inject slug/short variables - uses: rlespinasse/github-slug-action@v4 - - name: staging - run: | - echo "commit sha $GITHUB_SHA" - argo version --short - argo submit .argo/deploy.yaml \ - --generate-name="${GITHUB_REPOSITORY_NAME_PART}-staging-${GITHUB_SHA_SHORT}-" \ - -p appName="${GITHUB_REPOSITORY_NAME_PART}" \ - -p branch="${GITHUB_REF_NAME}" \ - -p clusterName="mgmt-20-kubefirst-com" \ - -p environment="staging" \ - -p gitUrlNoProtocol="git@github.com:${GITHUB_REPOSITORY_OWNER_PART_SLUG}" \ - -p shortSha="${GITHUB_SHA_SHORT}" \ - --wait --log - - run: echo "⭐️ the kubefirst open source platform is powered by github stars. give kubefirst one today https://github.com/kubefirst/kubefirst" - release: - needs: staging - runs-on: self-hosted - steps: - - name: Setup Runner for Argo - run: | - cd $HOME - echo "Install argo" - # Download the binary - curl -sLO https://github.com/argoproj/argo-workflows/releases/download/${ARGO_VERSION}/argo-linux-amd64.gz - # Unzip - gunzip argo-linux-amd64.gz - # Make binary executable - chmod +x argo-linux-amd64 - # Move binary to path - sudo mv ./argo-linux-amd64 /usr/local/bin/argo - # Test installation - argo version --short - - name: Check out repository code - uses: actions/checkout@v3 - - name: Inject slug/short variables - uses: rlespinasse/github-slug-action@v4 - # todo need to look repositoryGitURL, this needs to be overrideable from here and respected on the template side for both repositories - - name: release - run: | - echo "commit sha $GITHUB_SHA" - argo version --short - argo submit .argo/release.yaml \ - --generate-name="${GITHUB_REPOSITORY_NAME_PART}-release-${GITHUB_SHA_SHORT}-" \ - -p appName="${GITHUB_REPOSITORY_NAME_PART}" \ - -p branch="${GITHUB_REF_NAME}" \ - -p clusterName="mgmt-20-kubefirst-com" \ - -p environment="production" \ - -p gitUrlNoProtocol="git@github.com:${GITHUB_REPOSITORY_OWNER_PART_SLUG}" \ - -p shortSha="${GITHUB_SHA_SHORT}" \ - --wait --log - - run: echo "⭐️ the kubefirst open source platform is powered by github stars. give kubefirst one today https://github.com/kubefirst/kubefirst" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..f540f69 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,34 @@ +name: release +env: + ARGO_NAMESPACE: argo + ARGO_VERSION: v3.4.1 +on: workflow_dispatch +jobs: + release: + runs-on: self-hosted + steps: + - name: Check out repository code + uses: actions/checkout@v4 + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v4 + - name: release + run: | + echo "Install argo" + # Download the binary + curl -sLO https://github.com/argoproj/argo-workflows/releases/download/${ARGO_VERSION}/argo-linux-amd64.gz + # Unzip + gunzip argo-linux-amd64.gz + # Make binary executable + chmod +x argo-linux-amd64 + echo "commit sha ${GITHUB_SHA}" + ./argo-linux-amd64 version --short + ./argo-linux-amd64 submit .argo/release.yaml \ + --generate-name="${GITHUB_REPOSITORY_NAME_PART}-release-${GITHUB_SHA_SHORT}-" \ + -p appName="${GITHUB_REPOSITORY_NAME_PART}" \ + -p branch="${GITHUB_REF_NAME}" \ + -p environment="production" \ + -p gitUrlNoProtocol="git@github.com:${GITHUB_REPOSITORY_OWNER_PART_SLUG}" \ + -p shortSha="${GITHUB_SHA_SHORT}" \ + -p gitopsSourceFile="registry/environments/staging/flappy-kray.yaml" \ + -p gitopsDestinationFile="registry/environments/production/flappy-kray.yaml" \ + --wait --log diff --git a/.github/workflows/staging.yaml b/.github/workflows/staging.yaml new file mode 100644 index 0000000..116a29f --- /dev/null +++ b/.github/workflows/staging.yaml @@ -0,0 +1,35 @@ +name: staging +env: + ARGO_NAMESPACE: argo + ARGO_VERSION: v3.4.1 +on: workflow_dispatch +jobs: + staging: + runs-on: self-hosted + steps: + - name: Check out repository code + uses: actions/checkout@v4 + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v4 + - name: staging + run: | + echo "tag version: ${GITHUB_REF_NAME}" + echo "Install argo" + # Download the binary + curl -sLO https://github.com/argoproj/argo-workflows/releases/download/${ARGO_VERSION}/argo-linux-amd64.gz + # Unzip + gunzip argo-linux-amd64.gz + # Make binary executable + chmod +x argo-linux-amd64 + echo "commit sha ${GITHUB_SHA}" + ./argo-linux-amd64 version --short + ./argo-linux-amd64 submit .argo/staging.yaml \ + --generate-name="${GITHUB_REPOSITORY_NAME_PART}-staging-${GITHUB_SHA_SHORT}-" \ + -p appName="${GITHUB_REPOSITORY_NAME_PART}" \ + -p branch="${GITHUB_REF_NAME}" \ + -p environment="staging" \ + -p gitUrlNoProtocol="git@github.com:${GITHUB_REPOSITORY_OWNER_PART_SLUG}" \ + -p shortSha="${GITHUB_SHA_SHORT}" \ + -p gitopsSourceFile="registry/environments/development/flappy-kray.yaml" \ + -p gitopsDestinationFile="registry/environments/staging/flappy-kray.yaml" \ + --wait --log diff --git a/.github/workflows/trigger.yaml b/.github/workflows/trigger.yaml new file mode 100644 index 0000000..c986669 --- /dev/null +++ b/.github/workflows/trigger.yaml @@ -0,0 +1,32 @@ +name: trigger +env: + ARGO_NAMESPACE: argo + ARGO_VERSION: v3.4.1 + +on: workflow_dispatch + +jobs: + trigger: + runs-on: self-hosted + steps: + - name: Check out repository code + uses: actions/checkout@v4 + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v4 + - name: trigger + run: | + echo "Install argo" + # Download the binary + curl -sLO https://github.com/argoproj/argo-workflows/releases/download/${ARGO_VERSION}/argo-linux-amd64.gz + # Unzip + gunzip argo-linux-amd64.gz + # Make binary executable + chmod +x argo-linux-amd64 + echo "commit sha ${GITHUB_SHA}" + ./argo-linux-amd64 version --short + ./argo-linux-amd64 submit .argo/trigger.yaml \ + --generate-name="${GITHUB_REPOSITORY_NAME_PART}-trigger-${GITHUB_SHA_SHORT}-" \ + -p appName="${GITHUB_REPOSITORY_NAME_PART}" \ + -p branch="${GITHUB_REF_NAME}" \ + -p gitUrlNoProtocol="git@github.com:${GITHUB_REPOSITORY_OWNER_PART_SLUG}" \ + --wait --log diff --git a/package.json b/package.json index 9d50fa1..345bb3e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "flappy-kray", - "version": "0.1.0", + "version": "0.2.0", "description": "a modification of Clumsy Bird - A MelonJS port of the Flappy Bird game", "repository": { "type": "git",