From 57a8a77eed242b25a113935b65f2011ff65d7853 Mon Sep 17 00:00:00 2001 From: Are Almaas Date: Tue, 7 Jan 2025 15:41:31 +0100 Subject: [PATCH] ci: remove deployment of slack notifier --- .github/slack-templates/pipeline-failed.json | 2 +- .github/workflows/ci-cd-main.yml | 18 ----- .github/workflows/ci-cd-prod.yml | 19 +----- .github/workflows/ci-cd-staging.yml | 19 +----- .github/workflows/ci-cd-yt01.yml | 19 +----- .../workflows/workflow-deploy-function.yml | 67 ------------------- ...rkflow-send-ci-cd-status-slack-message.yml | 6 -- 7 files changed, 4 insertions(+), 146 deletions(-) delete mode 100644 .github/workflows/workflow-deploy-function.yml diff --git a/.github/slack-templates/pipeline-failed.json b/.github/slack-templates/pipeline-failed.json index cd02b10a0..43c41db3c 100644 --- a/.github/slack-templates/pipeline-failed.json +++ b/.github/slack-templates/pipeline-failed.json @@ -23,7 +23,7 @@ "type": "section", "text": { "type": "mrkdwn", - "text": "*Job Status:*\n• Infrastructure: ${{ env.INFRA_STATUS }}\n• Apps: ${{ env.APPS_STATUS }}\n• Slack Notifier: ${{ env.SLACK_NOTIFIER_STATUS }}\n• E2E Tests: ${{ env.E2E_TESTS_STATUS }}\n• Performance Tests: ${{ env.PERFORMANCE_TESTS_STATUS }}\n• Schema NPM: ${{ env.SCHEMA_NPM_STATUS }}\n• Publish: ${{ env.PUBLISH_STATUS }}" + "text": "*Job Status:*\n• Infrastructure: ${{ env.INFRA_STATUS }}\n• Apps: ${{ env.APPS_STATUS }}\n• E2E Tests: ${{ env.E2E_TESTS_STATUS }}\n• Performance Tests: ${{ env.PERFORMANCE_TESTS_STATUS }}\n• Schema NPM: ${{ env.SCHEMA_NPM_STATUS }}\n• Publish: ${{ env.PUBLISH_STATUS }}" } }, { diff --git a/.github/workflows/ci-cd-main.yml b/.github/workflows/ci-cd-main.yml index 52a8bd597..d77025508 100644 --- a/.github/workflows/ci-cd-main.yml +++ b/.github/workflows/ci-cd-main.yml @@ -108,22 +108,6 @@ jobs: version: ${{ needs.get-current-version.outputs.version }}-${{ needs.generate-git-short-sha.outputs.gitShortSha }} runMigration: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasMigrationChanges == 'true' }} - deploy-slack-notifier: - name: Deploy slack notifier (test) - needs: [check-for-changes] - if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasSlackNotifierChanges == 'true' }} - uses: ./.github/workflows/workflow-deploy-function.yml - secrets: - AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} - AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} - AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - # todo: resolve this automatically, or use tags - AZURE_FUNCTION_APP_NAME: ${{ secrets.AZURE_SLACK_NOTIFIER_FUNCTION_APP_NAME }} - with: - function-app-name: "slack-notifier" - function-project-path: "./src/Digdir.Tool.Dialogporten.SlackNotifier" - environment: test - publish-schema-npm: name: Deploy schema npm package needs: [check-for-changes, get-current-version, generate-git-short-sha, deploy-apps] @@ -156,7 +140,6 @@ jobs: needs: [ deploy-infra, deploy-apps, - deploy-slack-notifier, run-e2e-tests, publish-schema-npm, publish, @@ -168,7 +151,6 @@ jobs: environment: test infra_status: ${{ needs.deploy-infra.result }} apps_status: ${{ needs.deploy-apps.result }} - slack_notifier_status: ${{ needs.deploy-slack-notifier.result }} e2e_tests_status: ${{ needs.run-e2e-tests.result }} schema_npm_status: ${{ needs.publish-schema-npm.result }} publish_status: ${{ needs.publish.result }} diff --git a/.github/workflows/ci-cd-prod.yml b/.github/workflows/ci-cd-prod.yml index 4313c0110..7cf4ca86c 100644 --- a/.github/workflows/ci-cd-prod.yml +++ b/.github/workflows/ci-cd-prod.yml @@ -139,22 +139,6 @@ jobs: secrets: GH_TOKEN: ${{ secrets.RELEASE_VERSION_STORAGE_PAT }} - deploy-slack-notifier: - name: Deploy slack notifier (prod) - needs: [check-for-changes] - if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasSlackNotifierChanges == 'true' }} - uses: ./.github/workflows/workflow-deploy-function.yml - secrets: - AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} - AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} - AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - # todo: resolve this automatically, or use tags - AZURE_FUNCTION_APP_NAME: ${{ secrets.AZURE_SLACK_NOTIFIER_FUNCTION_APP_NAME }} - with: - function-app-name: "slack-notifier" - function-project-path: "./src/Digdir.Tool.Dialogporten.SlackNotifier" - environment: prod - # run-e2e-tests: # name: "Run K6 functional end-to-end tests" # # we want the end-to-end tests to be dependent on deployment of infrastructure and apps, but if infrastructure is skipped, we still want to run the tests @@ -174,14 +158,13 @@ jobs: send-slack-message-on-failure: name: Send Slack message on failure - needs: [deploy-infra, deploy-apps, deploy-slack-notifier] + needs: [deploy-infra, deploy-apps] if: ${{ always() && failure() && !cancelled() }} uses: ./.github/workflows/workflow-send-ci-cd-status-slack-message.yml with: environment: prod infra_status: ${{ needs.deploy-infra.result }} apps_status: ${{ needs.deploy-apps.result }} - slack_notifier_status: ${{ needs.deploy-slack-notifier.result }} secrets: SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID_FOR_CI_CD_STATUS }} diff --git a/.github/workflows/ci-cd-staging.yml b/.github/workflows/ci-cd-staging.yml index 5091b5238..611839543 100644 --- a/.github/workflows/ci-cd-staging.yml +++ b/.github/workflows/ci-cd-staging.yml @@ -105,22 +105,6 @@ jobs: secrets: GH_TOKEN: ${{ secrets.RELEASE_VERSION_STORAGE_PAT }} - deploy-slack-notifier: - name: Deploy slack notifier (staging) - needs: [check-for-changes] - if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasSlackNotifierChanges == 'true' }} - uses: ./.github/workflows/workflow-deploy-function.yml - secrets: - AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} - AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} - AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - # todo: resolve this automatically, or use tags - AZURE_FUNCTION_APP_NAME: ${{ secrets.AZURE_SLACK_NOTIFIER_FUNCTION_APP_NAME }} - with: - function-app-name: "slack-notifier" - function-project-path: "./src/Digdir.Tool.Dialogporten.SlackNotifier" - environment: staging - publish-schema-npm: name: Publish schema npm package needs: [check-for-changes, get-current-version, deploy-apps] @@ -150,14 +134,13 @@ jobs: send-slack-message-on-failure: name: Send Slack message on failure - needs: [deploy-infra, deploy-apps, deploy-slack-notifier, run-e2e-tests, publish-schema-npm, publish] + needs: [deploy-infra, deploy-apps, run-e2e-tests, publish-schema-npm, publish] if: ${{ always() && failure() && !cancelled() }} uses: ./.github/workflows/workflow-send-ci-cd-status-slack-message.yml with: environment: staging infra_status: ${{ needs.deploy-infra.result }} apps_status: ${{ needs.deploy-apps.result }} - slack_notifier_status: ${{ needs.deploy-slack-notifier.result }} e2e_tests_status: ${{ needs.run-e2e-tests.result }} schema_npm_status: ${{ needs.publish-schema-npm.result }} publish_status: ${{ needs.publish.result }} diff --git a/.github/workflows/ci-cd-yt01.yml b/.github/workflows/ci-cd-yt01.yml index ff4b53605..3d13d7805 100644 --- a/.github/workflows/ci-cd-yt01.yml +++ b/.github/workflows/ci-cd-yt01.yml @@ -107,22 +107,6 @@ jobs: secrets: GH_TOKEN: ${{ secrets.RELEASE_VERSION_STORAGE_PAT }} - deploy-slack-notifier: - name: Deploy slack notifier (yt01) - needs: [check-for-changes] - if: ${{ github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasSlackNotifierChanges == 'true' }} - uses: ./.github/workflows/workflow-deploy-function.yml - secrets: - AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} - AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} - AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - # todo: resolve this automatically, or use tags - AZURE_FUNCTION_APP_NAME: ${{ secrets.AZURE_SLACK_NOTIFIER_FUNCTION_APP_NAME }} - with: - function-app-name: "slack-notifier" - function-project-path: "./src/Digdir.Tool.Dialogporten.SlackNotifier" - environment: yt01 - run-e2e-tests: name: "Run K6 functional end-to-end tests" # we want the end-to-end tests to be dependent on deployment of infrastructure and apps, but if infrastructure is skipped, we still want to run the tests @@ -175,14 +159,13 @@ jobs: send-slack-message-on-failure: name: Send Slack message on failure - needs: [deploy-infra, deploy-apps, deploy-slack-notifier, run-e2e-tests, publish, run-performance-tests] + needs: [deploy-infra, deploy-apps, run-e2e-tests, publish, run-performance-tests] if: ${{ always() && failure() && !cancelled() }} uses: ./.github/workflows/workflow-send-ci-cd-status-slack-message.yml with: environment: yt01 infra_status: ${{ needs.deploy-infra.result }} apps_status: ${{ needs.deploy-apps.result }} - slack_notifier_status: ${{ needs.deploy-slack-notifier.result }} e2e_tests_status: ${{ needs.run-e2e-tests.result }} performance_tests_status: ${{ needs.run-performance-tests.result }} publish_status: ${{ needs.publish.result }} diff --git a/.github/workflows/workflow-deploy-function.yml b/.github/workflows/workflow-deploy-function.yml deleted file mode 100644 index e64632b22..000000000 --- a/.github/workflows/workflow-deploy-function.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Deploy DotNet project to Azure Function App - -on: - workflow_call: - secrets: - AZURE_CLIENT_ID: - required: true - AZURE_TENANT_ID: - required: true - AZURE_SUBSCRIPTION_ID: - required: true - AZURE_FUNCTION_APP_NAME: - required: true - - inputs: - function-app-name: - type: string - required: true - function-project-path: - type: string - required: true - environment: - type: string - required: true - -concurrency: - # If multiple merges to main are performed simultaneously, they will just be queued up. - group: ${{ github.workflow }}-${{ inputs.environment }}-${{ github.ref_name }} - -jobs: - build-and-deploy: - name: Build and deploy ${{ inputs.function-app-name }} to ${{ inputs.environment }} - runs-on: ubuntu-latest - environment: ${{ inputs.environment }} - permissions: - id-token: write - contents: read - steps: - - name: "Checkout GitHub Action" - uses: actions/checkout@v4 - - - name: OIDC Login to Azure Public Cloud - uses: azure/login@v2 - with: - client-id: ${{ secrets.AZURE_CLIENT_ID }} - tenant-id: ${{ secrets.AZURE_TENANT_ID }} - subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - - - name: Setup DotNet Environment - uses: actions/setup-dotnet@v4 - with: - global-json-file: ./global.json - - - name: "Resolve Project Dependencies Using Dotnet" - shell: bash - run: | - pushd './${{ inputs.function-project-path }}' - dotnet build -c Release -o ./output - popd - - - name: "Run Azure Functions Action" - uses: Azure/functions-action@v1 - id: fa - with: - app-name: ${{ secrets.AZURE_FUNCTION_APP_NAME }} - package: "${{ inputs.function-project-path }}/output" - publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }} diff --git a/.github/workflows/workflow-send-ci-cd-status-slack-message.yml b/.github/workflows/workflow-send-ci-cd-status-slack-message.yml index 557f5d1e6..ef613e320 100644 --- a/.github/workflows/workflow-send-ci-cd-status-slack-message.yml +++ b/.github/workflows/workflow-send-ci-cd-status-slack-message.yml @@ -14,10 +14,6 @@ on: type: string description: "Status of the apps deployment job" default: "skipped" - slack_notifier_status: - type: string - description: "Status of the Slack notifier deployment job" - default: "skipped" e2e_tests_status: type: string description: "Status of the end-to-end tests job" @@ -68,7 +64,6 @@ jobs: { echo "INFRA_EMOJI=$(determine_emoji "${{ inputs.infra_status }}")" echo "APPS_EMOJI=$(determine_emoji "${{ inputs.apps_status }}")" - echo "SLACK_NOTIFIER_EMOJI=$(determine_emoji "${{ inputs.slack_notifier_status }}")" echo "E2E_TESTS_EMOJI=$(determine_emoji "${{ inputs.e2e_tests_status }}")" echo "SCHEMA_NPM_EMOJI=$(determine_emoji "${{ inputs.schema_npm_status }}")" echo "PUBLISH_EMOJI=$(determine_emoji "${{ inputs.publish_status }}")" @@ -85,7 +80,6 @@ jobs: # statuses INFRA_STATUS: "${{ steps.status-emojis.outputs.INFRA_EMOJI }}" APPS_STATUS: "${{ steps.status-emojis.outputs.APPS_EMOJI }}" - SLACK_NOTIFIER_STATUS: "${{ steps.status-emojis.outputs.SLACK_NOTIFIER_EMOJI }}" E2E_TESTS_STATUS: "${{ steps.status-emojis.outputs.E2E_TESTS_EMOJI }}" SCHEMA_NPM_STATUS: "${{ steps.status-emojis.outputs.SCHEMA_NPM_EMOJI }}" PUBLISH_STATUS: "${{ steps.status-emojis.outputs.PUBLISH_EMOJI }}"