From 792eb668a45a2f8e3e4e3c5af09c7e8a52fd7e63 Mon Sep 17 00:00:00 2001 From: phil-l-brockwell Date: Wed, 27 Nov 2024 13:41:58 +0000 Subject: [PATCH 1/2] Remove deploy jobs from github/workflows/ci.yml --- .github/workflows/ci.yml | 83 ---------------------------------------- 1 file changed, 83 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5f427623d..8e75dd7c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,86 +81,3 @@ jobs: bundler-cache: true - name: Lint Ruby files run: bundle exec rubocop --require rubocop-rails --format github - deploy_dev: - needs: [test] - if: github.ref == 'refs/heads/main' - runs-on: ubuntu-latest - strategy: - max-parallel: 1 - steps: - - uses: actions/checkout@v2 - - uses: actions/cache@v2 - with: - path: vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gems- - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ env.ruby-version }} - - uses: actions/setup-node@v2-beta - with: - node-version: '20' - - name: 'Deploy dev' - env: - name: dev - url: 'https://dev.queens-awards-enterprise.service.gov.uk/' - CF_ENDPOINT: 'api.london.cloud.service.gov.uk' - CF_SPACE: dev - CF_APP: qae-dev - CF_USER: ${{ secrets.CF_USER }} - CF_PASSWORD: ${{ secrets.CF_PASSWORD }} - CF_ORG: ${{ secrets.CF_ORG }} - SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }} - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - run: | - npm install -g yarn - wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add - - echo "deb [trusted=yes] https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list - sudo apt-get update - sudo apt-get install cf7-cli - cf -v - cf add-plugin-repo CF-Community https://plugins.cloudfoundry.org - cf install-plugin blue-green-deploy -r CF-Community -f - ./bin/deploy - deploy_staging: - needs: [test] - if: github.ref == 'refs/heads/staging' - runs-on: ubuntu-latest - strategy: - max-parallel: 1 - steps: - - uses: actions/checkout@v2 - - uses: actions/cache@v2 - with: - path: vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gems- - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ env.ruby-version }} - - uses: actions/setup-node@v2-beta - with: - node-version: '20' - - name: 'Deploy staging' - env: - name: staging - url: 'https://staging.queens-awards-enterprise.service.gov.uk/' - CF_ENDPOINT: 'api.london.cloud.service.gov.uk' - CF_SPACE: staging - CF_APP: qae-staging - CF_USER: ${{ secrets.CF_USER }} - CF_PASSWORD: ${{ secrets.CF_PASSWORD }} - CF_ORG: ${{ secrets.CF_ORG }} - SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }} - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - run: | - curl -v -L -o cf-cli_amd64.deb 'https://cli.run.pivotal.io/stable?release=debian64&source=github' - sudo dpkg -i cf-cli_amd64.deb - cf -v - cf add-plugin-repo CF-Community https://plugins.cloudfoundry.org - cf install-plugin blue-green-deploy -r CF-Community -f - ./bin/deploy From ff22c29abaa665653f22803d6d1226c9bc144e72 Mon Sep 17 00:00:00 2001 From: phil-l-brockwell Date: Wed, 27 Nov 2024 16:22:02 +0000 Subject: [PATCH 2/2] Simplfy slack notifications --- .github/workflows/slack_notification.yml | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/.github/workflows/slack_notification.yml b/.github/workflows/slack_notification.yml index 56fa9d6d5..74726a1ac 100644 --- a/.github/workflows/slack_notification.yml +++ b/.github/workflows/slack_notification.yml @@ -1,4 +1,4 @@ -name: Check for tests or deployment results +name: Check for workflow results on: workflow_run: workflows: ["CI","Dev deployment","Staging deployment","Production deployment"] @@ -28,22 +28,11 @@ jobs: done echo "::set-output name=suid::$suid" - - name: tests + - name: workflow-complete uses: ravsamhq/notify-slack-action@v2 - if: ${{ github.event.workflow_run.head_branch != 'main' && github.event.workflow_run.head_branch != 'staging' && github.event.workflow_run.head_branch != 'production' }} with: status: ${{ github.event.workflow_run.conclusion }} - notification_title: "Tests ${{github.event.workflow_run.conclusion}} on *${{github.event.workflow_run.head_branch}}* - <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View ${{github.event.workflow_run.conclusion}}>" - message_format: "{emoji} *${{github.event.workflow_run.name}}* ${{github.event.workflow_run.conclusion}} in <{repo_url}|{repo}>" - footer: "Linked Repo <${{github.server_url}}/${{github.repository}}|${{github.repository}}> | <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View ${{github.event.workflow_run.conclusion}}>" - mention_users: ${{ steps.extract_slack_id.outputs.suid }} - mention_users_when: "failure,warnings" - - name: deployment - uses: ravsamhq/notify-slack-action@v2 - if: ${{ github.event.workflow_run.head_branch == 'main' || github.event.workflow_run.head_branch == 'staging' || github.event.workflow_run.head_branch == 'production' }} - with: - status: ${{ github.event.workflow_run.conclusion }} - notification_title: "Deployment ${{github.event.workflow_run.conclusion}} on *${{github.event.workflow_run.head_branch}}* - <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View ${{github.event.workflow_run.conclusion}}>" + notification_title: "Workflow ${{github.event.workflow_run.conclusion}} on *${{github.event.workflow_run.head_branch}}* - <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View ${{github.event.workflow_run.conclusion}}>" message_format: "{emoji} *${{github.event.workflow_run.name}}* ${{github.event.workflow_run.conclusion}} in <{repo_url}|{repo}>" footer: "Linked Repo <${{github.server_url}}/${{github.repository}}|${{github.repository}}> | <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View ${{github.event.workflow_run.conclusion}}>" mention_users: ${{ steps.extract_slack_id.outputs.suid }}