From f7e66ec7a638b9ff0fef5fbf3bb4bce4dd435ae2 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Tue, 12 Mar 2024 11:34:55 +0100 Subject: [PATCH 1/3] wait for image in deploy.yaml --- .github/workflows/deploy.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 14ed79251..ab6ed8fd2 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -34,6 +34,12 @@ jobs: echo "Environment: ${{ inputs.environment }}" echo "Version: ${{ inputs.version }}" + - name: Wait for image + uses: stackrox/actions/release/wait-for-image@v1 + with: + token: ${{ secrets.QUAY_RHACS_ENG_BEARER_TOKEN }} + image: rhacs-eng/infra-server:${{ inputs.version }} + - name: Check out code uses: actions/checkout@v4 with: From c7b6ec4684126235fc5ae8fec29dd14a244635b9 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Tue, 12 Mar 2024 11:38:00 +0100 Subject: [PATCH 2/3] use matrix --- .github/workflows/deploy.yaml | 98 +++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 46 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index ab6ed8fd2..50a22de10 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -26,60 +26,66 @@ on: required: true jobs: - deploy: + wait-for-images: runs-on: ubuntu-latest + strategy: + matrix: + image: [infra-server, infra-certifier] steps: - - name: Show inputs - run: | - echo "Environment: ${{ inputs.environment }}" - echo "Version: ${{ inputs.version }}" - - name: Wait for image uses: stackrox/actions/release/wait-for-image@v1 with: token: ${{ secrets.QUAY_RHACS_ENG_BEARER_TOKEN }} - image: rhacs-eng/infra-server:${{ inputs.version }} + image: rhacs-eng/${{ matrix.image }}:${{ inputs.version }} - - name: Check out code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: ${{ inputs.version }} + # deploy: + # runs-on: ubuntu-latest + # steps: + # - name: Show inputs + # run: | + # echo "Environment: ${{ inputs.environment }}" + # echo "Version: ${{ inputs.version }}" - - name: Authenticate to GCloud - uses: google-github-actions/auth@v2 - with: - credentials_json: ${{ secrets.INFRA_DEPLOY_AUTOMATION_GCP_SA }} + # - name: Check out code + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # ref: ${{ inputs.version }} - - name: 'Set up Cloud SDK' - uses: 'google-github-actions/setup-gcloud@v2' - with: - install_components: "gke-gcloud-auth-plugin" + # - name: Authenticate to GCloud + # uses: google-github-actions/auth@v2 + # with: + # credentials_json: ${{ secrets.INFRA_DEPLOY_AUTOMATION_GCP_SA }} - - name: Deploy to ${{ inputs.environment }} - env: - USE_GKE_GCLOUD_AUTH_PLUGIN: "True" - run: | - gcloud container clusters get-credentials infra-${{ inputs.environment }} \ - --project "${PROJECT}" \ - --region us-west2 - ENVIRONMENT=${{ inputs.environment }} make install-argo clean-argo-config install-monitoring helm-deploy + # - name: 'Set up Cloud SDK' + # uses: 'google-github-actions/setup-gcloud@v2' + # with: + # install_components: "gke-gcloud-auth-plugin" - - name: Notify infra channel about new version - env: - SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} - uses: slackapi/slack-github-action@v1.25.0 - with: - channel-id: CVANK5K5W #acs-infra - payload: >- - { - "blocks": [ - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": ":ship::tada:*Infra (${{ inputs.environment }}) was updated to ${{ inputs.version }}.*\nTo see the latest changes, click <${{ github.server_url }}/${{ github.repository }}/blob/${{ inputs.version }}/CHANGELOG.md|here>." - } - } - ] - } + # - name: Deploy to ${{ inputs.environment }} + # env: + # USE_GKE_GCLOUD_AUTH_PLUGIN: "True" + # run: | + # gcloud container clusters get-credentials infra-${{ inputs.environment }} \ + # --project "${PROJECT}" \ + # --region us-west2 + # ENVIRONMENT=${{ inputs.environment }} make install-argo clean-argo-config install-monitoring helm-deploy + + # - name: Notify infra channel about new version + # env: + # SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} + # uses: slackapi/slack-github-action@v1.25.0 + # with: + # channel-id: CVANK5K5W #acs-infra + # payload: >- + # { + # "blocks": [ + # { + # "type": "section", + # "text": { + # "type": "mrkdwn", + # "text": ":ship::tada:*Infra (${{ inputs.environment }}) was updated to ${{ inputs.version }}.*\nTo see the latest changes, click <${{ github.server_url }}/${{ github.repository }}/blob/${{ inputs.version }}/CHANGELOG.md|here>." + # } + # } + # ] + # } From 9037da735acee5c4ffd2fdb4547b93c70e058b15 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Tue, 12 Mar 2024 11:45:34 +0100 Subject: [PATCH 3/3] full workflow --- .github/workflows/deploy.yaml | 94 ++++++++++++++++++----------------- 1 file changed, 48 insertions(+), 46 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 50a22de10..6bfc0588b 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -37,55 +37,57 @@ jobs: with: token: ${{ secrets.QUAY_RHACS_ENG_BEARER_TOKEN }} image: rhacs-eng/${{ matrix.image }}:${{ inputs.version }} + limit: 1800 - # deploy: - # runs-on: ubuntu-latest - # steps: - # - name: Show inputs - # run: | - # echo "Environment: ${{ inputs.environment }}" - # echo "Version: ${{ inputs.version }}" + deploy: + runs-on: ubuntu-latest + needs: [wait-for-images] + steps: + - name: Show inputs + run: | + echo "Environment: ${{ inputs.environment }}" + echo "Version: ${{ inputs.version }}" - # - name: Check out code - # uses: actions/checkout@v4 - # with: - # fetch-depth: 0 - # ref: ${{ inputs.version }} + - name: Check out code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ inputs.version }} - # - name: Authenticate to GCloud - # uses: google-github-actions/auth@v2 - # with: - # credentials_json: ${{ secrets.INFRA_DEPLOY_AUTOMATION_GCP_SA }} + - name: Authenticate to GCloud + uses: google-github-actions/auth@v2 + with: + credentials_json: ${{ secrets.INFRA_DEPLOY_AUTOMATION_GCP_SA }} - # - name: 'Set up Cloud SDK' - # uses: 'google-github-actions/setup-gcloud@v2' - # with: - # install_components: "gke-gcloud-auth-plugin" + - name: 'Set up Cloud SDK' + uses: 'google-github-actions/setup-gcloud@v2' + with: + install_components: "gke-gcloud-auth-plugin" - # - name: Deploy to ${{ inputs.environment }} - # env: - # USE_GKE_GCLOUD_AUTH_PLUGIN: "True" - # run: | - # gcloud container clusters get-credentials infra-${{ inputs.environment }} \ - # --project "${PROJECT}" \ - # --region us-west2 - # ENVIRONMENT=${{ inputs.environment }} make install-argo clean-argo-config install-monitoring helm-deploy + - name: Deploy to ${{ inputs.environment }} + env: + USE_GKE_GCLOUD_AUTH_PLUGIN: "True" + run: | + gcloud container clusters get-credentials infra-${{ inputs.environment }} \ + --project "${PROJECT}" \ + --region us-west2 + ENVIRONMENT=${{ inputs.environment }} make install-argo clean-argo-config install-monitoring helm-deploy - # - name: Notify infra channel about new version - # env: - # SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} - # uses: slackapi/slack-github-action@v1.25.0 - # with: - # channel-id: CVANK5K5W #acs-infra - # payload: >- - # { - # "blocks": [ - # { - # "type": "section", - # "text": { - # "type": "mrkdwn", - # "text": ":ship::tada:*Infra (${{ inputs.environment }}) was updated to ${{ inputs.version }}.*\nTo see the latest changes, click <${{ github.server_url }}/${{ github.repository }}/blob/${{ inputs.version }}/CHANGELOG.md|here>." - # } - # } - # ] - # } + - name: Notify infra channel about new version + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} + uses: slackapi/slack-github-action@v1.25.0 + with: + channel-id: CVANK5K5W #acs-infra + payload: >- + { + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": ":ship::tada:*Infra (${{ inputs.environment }}) was updated to ${{ inputs.version }}.*\nTo see the latest changes, click <${{ github.server_url }}/${{ github.repository }}/blob/${{ inputs.version }}/CHANGELOG.md|here>." + } + } + ] + }