diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 04d9cbb..9d0318e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,7 @@ jobs: timeout-minutes: 10 outputs: VERSION: ${{ steps.version.outputs.VERSION }} + DATE_TAG: ${{ steps.version.outputs.DATE_TAG }} steps: - name: Define version id: version @@ -23,6 +24,7 @@ jobs: export COMMIT_SHA_SHORT=${COMMIT_SHA:0:8} export REF_NAME=${{ github.ref_name }} export REF_SLUG=${REF_NAME//\//_} + echo "DATE_TAG=$(date -u +'%Y%m%d-%H%M%S')-${COMMIT_SHA_SHORT}" >> ${GITHUB_OUTPUT} echo "short sha: ${COMMIT_SHA_SHORT} slug: ${REF_SLUG}" if [[ ${REF_SLUG} == "master" ]] then @@ -57,6 +59,7 @@ jobs: timeout-minutes: 10 env: VERSION: ${{ needs.set-variables.outputs.VERSION }} + DATE_TAG: ${{ needs.set-variables.outputs.DATE_TAG }} IMAGE_NAME: "docker.io/paritytech/substrate-tip-bot" steps: - name: Check out the repo @@ -70,3 +73,4 @@ jobs: push: false tags: | ${{ env.IMAGE_NAME }}:${{ env.VERSION }} + ${{ env.IMAGE_NAME }}:${{ env.DATE_TAG }} diff --git a/.github/workflows/publish-deploy.yml b/.github/workflows/publish-deploy.yml index 3b3c017..af8e80c 100644 --- a/.github/workflows/publish-deploy.yml +++ b/.github/workflows/publish-deploy.yml @@ -26,6 +26,7 @@ jobs: runs-on: ubuntu-latest outputs: VERSION: ${{ steps.version.outputs.VERSION }} + DATE_TAG: ${{ steps.version.outputs.DATE_TAG }} steps: - name: Define version id: version @@ -33,6 +34,7 @@ jobs: export COMMIT_SHA=${{ github.sha }} export COMMIT_SHA_SHORT=${COMMIT_SHA:0:8} export REF_NAME=${{ github.ref_name }} + echo "DATE_TAG=$(date -u +'%Y%m%d-%H%M%S')-${COMMIT_SHA_SHORT}" >> ${GITHUB_OUTPUT} export REF_SLUG=${REF_NAME//\//_} echo "short sha: ${COMMIT_SHA_SHORT} slug: ${REF_SLUG}" if [[ ${REF_SLUG} == "master" ]] @@ -51,6 +53,8 @@ jobs: needs: [set-variables] env: VERSION: ${{ needs.set-variables.outputs.VERSION }} + DATE_TAG: ${{ needs.set-variables.outputs.DATE_TAG }} + IMAGE_NAME: "docker.io/paritytech/substrate-tip-bot" steps: - name: Check out the repo uses: actions/checkout@v4 @@ -67,48 +71,5 @@ jobs: file: ./Dockerfile push: true tags: | - docker.io/paritytech/substrate-tip-bot:${{ env.VERSION }} - - deploy-stg: - name: Deploy Staging - runs-on: ubuntu-latest - needs: [set-variables, build_push_docker] - environment: parity-stg - env: - VERSION: ${{ needs.set-variables.outputs.VERSION }} - ARGOCD_SERVER: "argocd-stg.teleport.parity.io" - steps: - - name: Deploy to ArgoCD - uses: paritytech/argocd-deployment-action@main - with: - environment: "parity-stg" - tag: "${{ env.VERSION }}" - app_name: "${{ env.APP }}" - app_packages: "common" - argocd_server: ${{ env.ARGOCD_SERVER }} - teleport_token: "substrate-tip" - teleport_app_name: "argocd-stg" - argocd_auth_token: ${{ secrets.ARGOCD_AUTH_TOKEN }} - - deploy-prod: - name: Deploy Production - runs-on: ubuntu-latest - needs: [set-variables, deploy-stg] - # deploy only on tags - if: startsWith(github.ref, 'refs/tags/v') - environment: parity-prod - env: - VERSION: ${{ needs.set-variables.outputs.VERSION }} - ARGOCD_SERVER: "argocd-prod.teleport.parity.io" - steps: - - name: Deploy to ArgoCD - uses: paritytech/argocd-deployment-action@main - with: - environment: "parity-prod" - tag: "${{ env.VERSION }}" - app_name: "${{ env.APP }}" - app_packages: "common" - argocd_server: ${{ env.ARGOCD_SERVER }} - teleport_token: "substrate-tip" - teleport_app_name: "argocd-prod" - argocd_auth_token: ${{ secrets.ARGOCD_AUTH_TOKEN }} + ${{ env.IMAGE_NAME }}:${{ env.VERSION }} + ${{ env.IMAGE_NAME }}:${{ env.DATE_TAG }} diff --git a/helm/Chart.yaml b/helm/Chart.yaml deleted file mode 100644 index 9affd2f..0000000 --- a/helm/Chart.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: v2 -name: substrate-tip-bot -description: A Helm chart for Kubernetes -type: application -version: 0.1.0 -appVersion: "1.0.0" -dependencies: -- name: common - version: "0.7.2" - repository: "https://paritytech.github.io/helm-charts/" \ No newline at end of file diff --git a/helm/values-parity-prod.yaml b/helm/values-parity-prod.yaml deleted file mode 100644 index 59585f8..0000000 --- a/helm/values-parity-prod.yaml +++ /dev/null @@ -1,33 +0,0 @@ -common: - env: - APP_HOST: "https://substrate-tip-bot.parity-prod.parity.io" - APPROVERS_GH_ORG: "paritytech" - APPROVERS_GH_TEAM: "tip-bot-approvers" - POLKASSEMBLY_ENDPOINT: "https://api.polkassembly.io/api/v1/" - MATRIX_SERVER_URL: "https://m.parity.io" - MATRIX_ROOM_ID: "!tQFMxBymnjGQYNwlzM:parity.io" # ENG: Engineering Automation -> tip-bot - secrets: - # WEBHOOK_SECRET is used internally by probot: https://probot.github.io/docs/configuration/ - WEBHOOK_SECRET: ref+vault://kv/argo-cd/substrate-tip-bot/opstooling-parity-prod#WEBHOOK_SECRET - PRIVATE_KEY: ref+vault://kv/argo-cd/substrate-tip-bot/opstooling-parity-prod#PRIVATE_KEY - ACCOUNT_SEED: ref+vault://kv/argo-cd/substrate-tip-bot/opstooling-parity-prod#ACCOUNT_SEED - APP_ID: ref+vault://kv/argo-cd/substrate-tip-bot/opstooling-parity-prod#APP_ID - MATRIX_ACCESS_TOKEN: ref+vault://kv/argo-cd/substrate-tip-bot/opstooling-parity-prod#MATRIX_ACCESS_TOKEN - ingress: - annotations: - external-dns.alpha.kubernetes.io/target: traefik-external.parity-prod.parity.io. - rules: - - host: substrate-tip-bot.parity-prod.parity.io - http: - paths: - - path: / - pathType: ImplementationSpecific - backend: - service: - name: substrate-tip-bot - port: - name: http - tls: - - hosts: - - substrate-tip-bot.parity-prod.parity.io - secretName: substrate-tip-bot.parity-prod.parity.io \ No newline at end of file diff --git a/helm/values-parity-stg.yaml b/helm/values-parity-stg.yaml deleted file mode 100644 index d2663ad..0000000 --- a/helm/values-parity-stg.yaml +++ /dev/null @@ -1,33 +0,0 @@ -common: - env: - APP_HOST: "https://substrate-tip-bot.parity-stg.parity.io" - APPROVERS_GH_ORG: "paritytech-stg" - APPROVERS_GH_TEAM: "tip-bot-approvers" - POLKASSEMBLY_ENDPOINT: "https://test.polkassembly.io/api/v1/" - MATRIX_SERVER_URL: "https://m.parity.io" - MATRIX_ROOM_ID: "!KiTmXyGkdiLNzrzMgj:parity.io" # ENG: Engineering Automation -> Bot Test Farm - secrets: - # WEBHOOK_SECRET is used internally by probot: https://probot.github.io/docs/configuration/ - WEBHOOK_SECRET: ref+vault://kv/argo-cd/substrate-tip-bot/opstooling-parity-stg#WEBHOOK_SECRET - PRIVATE_KEY: ref+vault://kv/argo-cd/substrate-tip-bot/opstooling-parity-stg#PRIVATE_KEY - ACCOUNT_SEED: ref+vault://kv/argo-cd/substrate-tip-bot/opstooling-parity-stg#ACCOUNT_SEED - APP_ID: ref+vault://kv/argo-cd/substrate-tip-bot/opstooling-parity-stg#APP_ID - MATRIX_ACCESS_TOKEN: ref+vault://kv/argo-cd/substrate-tip-bot/opstooling-parity-stg#MATRIX_ACCESS_TOKEN - ingress: - annotations: - external-dns.alpha.kubernetes.io/target: traefik-external.parity-stg.parity.io. - rules: - - host: substrate-tip-bot.parity-stg.parity.io - http: - paths: - - path: / - pathType: ImplementationSpecific - backend: - service: - name: substrate-tip-bot - port: - name: http - tls: - - hosts: - - substrate-tip-bot.parity-stg.parity.io - secretName: substrate-tip-bot.parity-stg.parity.io \ No newline at end of file diff --git a/helm/values.yaml b/helm/values.yaml deleted file mode 100644 index d848345..0000000 --- a/helm/values.yaml +++ /dev/null @@ -1,48 +0,0 @@ -common: - fullnameOverride: "substrate-tip-bot" - extraLabels: - team: "opstooling" - serviceAccount: - create: false - image: - # tag is set in ci https://github.com/paritytech/substrate-tip-bot/blob/72a5a0228c0405e211f6ff768cfd4010b3323658/.gitlab-ci.yml#L152 - repository: paritytech/substrate-tip-bot - envFrom: - - secretRef: - name: substrate-tip-bot - service: - ports: - - name: http - protocol: TCP - port: 80 - targetPort: 3000 - ingress: - enabled: true - annotations: - cert-manager.io/cluster-issuer: letsencrypt-dns01 - kubernetes.io/ingress.class: traefik-external - traefik.ingress.kubernetes.io/router.entrypoints: web,websecure - traefik.ingress.kubernetes.io/router.tls: "true" - livenessProbe: - httpGet: - path: /tip-bot/health - port: http - initialDelaySeconds: 60 - periodSeconds: 5 - readinessProbe: - httpGet: - path: /tip-bot/health - port: http - initialDelaySeconds: 60 - periodSeconds: 5 - serviceMonitor: - enabled: true - endpoints: - - port: http - path: /tip-bot/metrics - interval: 1m - scheme: http - scrapeTimeout: 30s - honorLabels: true - targetLabels: - - team \ No newline at end of file diff --git a/manifest-production.yaml b/manifest-production.yaml new file mode 100644 index 0000000..b1ecd43 --- /dev/null +++ b/manifest-production.yaml @@ -0,0 +1,15 @@ +images: + substrate-tip-bot: + env: + APP_HOST: "https://substrate-tip-bot.parity-prod.parity.io" + APPROVERS_GH_ORG: "paritytech" + APPROVERS_GH_TEAM: "tip-bot-approvers" + POLKASSEMBLY_ENDPOINT: "https://api.polkassembly.io/api/v1/" + MATRIX_SERVER_URL: "https://m.parity.io" + MATRIX_ROOM_ID: "!tQFMxBymnjGQYNwlzM:parity.io" # ENG: Engineering Automation -> tip-bot + # WEBHOOK_SECRET is used internally by probot: https://probot.github.io/docs/configuration/ + WEBHOOK_SECRET: ref+vault://kv/argo-cd/substrate-tip-bot/opstooling-parity-prod#WEBHOOK_SECRET + PRIVATE_KEY: ref+vault://kv/argo-cd/substrate-tip-bot/opstooling-parity-prod#PRIVATE_KEY + ACCOUNT_SEED: ref+vault://kv/argo-cd/substrate-tip-bot/opstooling-parity-prod#ACCOUNT_SEED + APP_ID: ref+vault://kv/argo-cd/substrate-tip-bot/opstooling-parity-prod#APP_ID + MATRIX_ACCESS_TOKEN: ref+vault://kv/argo-cd/substrate-tip-bot/opstooling-parity-prod#MATRIX_ACCESS_TOKEN diff --git a/manifest-staging.yaml b/manifest-staging.yaml new file mode 100644 index 0000000..bb486eb --- /dev/null +++ b/manifest-staging.yaml @@ -0,0 +1,15 @@ +images: + substrate-tip-bot: + env: + APP_HOST: "https://substrate-tip-bot.parity-stg.parity.io" + APPROVERS_GH_ORG: "paritytech-stg" + APPROVERS_GH_TEAM: "tip-bot-approvers" + POLKASSEMBLY_ENDPOINT: "https://test.polkassembly.io/api/v1/" + MATRIX_SERVER_URL: "https://m.parity.io" + MATRIX_ROOM_ID: "!KiTmXyGkdiLNzrzMgj:parity.io" # ENG: Engineering Automation -> Bot Test Farm + # WEBHOOK_SECRET is used internally by probot: https://probot.github.io/docs/configuration/ + WEBHOOK_SECRET: ref+vault://kv/argo-cd/substrate-tip-bot/opstooling-parity-stg#WEBHOOK_SECRET + PRIVATE_KEY: ref+vault://kv/argo-cd/substrate-tip-bot/opstooling-parity-stg#PRIVATE_KEY + ACCOUNT_SEED: ref+vault://kv/argo-cd/substrate-tip-bot/opstooling-parity-stg#ACCOUNT_SEED + APP_ID: ref+vault://kv/argo-cd/substrate-tip-bot/opstooling-parity-stg#APP_ID + MATRIX_ACCESS_TOKEN: ref+vault://kv/argo-cd/substrate-tip-bot/opstooling-parity-stg#MATRIX_ACCESS_TOKEN diff --git a/manifest.yaml b/manifest.yaml new file mode 100644 index 0000000..1cc0067 --- /dev/null +++ b/manifest.yaml @@ -0,0 +1,7 @@ +images: + substrate-tip-bot: + dockerfile: ./Dockerfile + context: . + port: 3000 + http: + path: /