Skip to content

Commit

Permalink
Merge pull request #18 from pagopa/add-notification-webhook
Browse files Browse the repository at this point in the history
feat: added Slack notification
  • Loading branch information
andrea-deri authored Sep 19, 2023
2 parents 121367e + 7e44aab commit 2bf9e49
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 37 deletions.
46 changes: 23 additions & 23 deletions .github/workflows/04_release_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ jobs:
needs: [ setup, release ]
name: Build and Push Docker Image
runs-on: ubuntu-latest
if: ${{ inputs.semver != 'skip' }}
if: ${{ needs.setup.outputs.semver != 'skip' }}
environment: ${{ needs.setup.outputs.environment }}
steps:
- name: Build and Push
Expand Down Expand Up @@ -187,22 +187,22 @@ jobs:
- name: 'Azure CLI script: start staging slot'
uses: azure/CLI@v1
if: ${{ contains(github.event.inputs.environment, 'prod') }}
if: ${{ needs.setup.outputs.environment == 'prod' }}
with:
inlineScript: |
az functionapp start --name ${{ env.APP_NAME }} --resource-group ${{ env.RESOURCE_GROUP }} --slot staging
- name: 'Run Azure Functions Container Action: staging slot'
uses: Azure/functions-container-action@v1.2.1
if: ${{ contains(github.event.inputs.environment, 'prod')}}
if: ${{ needs.setup.outputs.environment == 'prod' }}
with:
app-name: ${{ env.APP_NAME }}
image: ${{ env.REGISTRY_IMAGE }}
slot-name: staging

- name: 'Deploy Approval'
uses: trstringer/manual-approval@v1
if: ${{ contains(github.event.inputs.environment, 'prod')}}
if: ${{ needs.setup.outputs.environment == 'prod' }}
with:
secret: ${{ secrets.BOT_TOKEN_GITHUB }}
approvers: pagopa-team-core
Expand All @@ -221,7 +221,7 @@ jobs:

- name: 'Azure CLI script: end staging slot'
uses: azure/CLI@v1
if: ${{ contains(github.event.inputs.environment, 'prod') }}
if: ${{ needs.setup.outputs.environment == 'prod' }}
with:
inlineScript: |
az functionapp stop --name ${{ env.APP_NAME }} --resource-group ${{ env.RESOURCE_GROUP }} --slot staging
Expand All @@ -230,21 +230,21 @@ jobs:
run: |
az logout
## notify:
## needs: [ deploy_azure_fn ]
## runs-on: ubuntu-latest
## name: Notify
## if: always()
## steps:
## - name: Report Status
## if: always()
## uses: ravsamhq/notify-slack-action@v2
## with:
## status: ${{ needs.deploy_azure_fn.result }}
## token: ${{ secrets.GITHUB_TOKEN }}
## notify_when: 'failure,skipped'
## notification_title: '{workflow} has {status_message}'
## message_format: '{emoji} <{workflow_url}|{workflow}> {status_message} in <{repo_url}|{repo}>'
## footer: 'Linked to Repo <{repo_url}|{repo}>'
## env:
## SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
notify:
needs: [ setup, release, deploy_azure_fn ]
runs-on: ubuntu-latest
name: Notify
if: always()
steps:
- name: Report Status
if: always()
uses: ravsamhq/notify-slack-action@v2
with:
status: ${{ needs.deploy_azure_fn.result }}
token: ${{ secrets.GITHUB_TOKEN }}
notification_title: 'New Release on ${{ needs.setup.outputs.environment }} ${{ needs.release.outputs.version }} has {status_message}'
message_format: '{emoji} <{run_url}|{workflow}> {status_message} in <{repo_url}|{repo}>'
footer: 'Linked to <{workflow_url}| workflow file>'
icon_success: ':white_check_mark:'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
15 changes: 5 additions & 10 deletions .identity/00_data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,11 @@ data "azurerm_key_vault_secret" "key_vault_bot_token" {
key_vault_id = data.azurerm_key_vault.key_vault.id
}

data "azurerm_key_vault_secret" "key_vault_slack_webhook_url" {
name = "slack-webhook-url"
key_vault_id = data.azurerm_key_vault.domain_key_vault.id
}

data "azurerm_resource_group" "nodo_re_rg" {
name = "pagopa-${var.env_short}-${local.location_short}-nodo-re-to-datastore-rg"
}

#data "azurerm_key_vault_secret" "key_vault_cucumber_token" {
# name = "cucumber-token"
# key_vault_id = data.azurerm_key_vault.key_vault.id
#}

#data "azurerm_key_vault_secret" "key_vault_integration_test_subkey" {
# name = "integration-test-subkey"
# key_vault_id = data.azurerm_key_vault.key_vault.id
#}
4 changes: 1 addition & 3 deletions .identity/03_github_environment.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ locals {
"CLIENT_ID" : module.github_runner_app.application_id,
"TENANT_ID" : data.azurerm_client_config.current.tenant_id,
"SUBSCRIPTION_ID" : data.azurerm_subscription.current.subscription_id,
"ISSUER_RANGE_TABLE" : "${local.prefix}${var.env_short}${local.location_short}${local.domain}saissuerrangetable",
# "SUBKEY" : data.azurerm_key_vault_secret.key_vault_integration_test_subkey.value,
}
env_variables = {
"CONTAINER_APP_ENVIRONMENT_NAME" : local.container_app_environment.name,
Expand All @@ -38,7 +36,7 @@ locals {
repo_secrets = {
"SONAR_TOKEN" : data.azurerm_key_vault_secret.key_vault_sonar.value,
"BOT_TOKEN_GITHUB" : data.azurerm_key_vault_secret.key_vault_bot_token.value,
# "CUCUMBER_PUBLISH_TOKEN" : data.azurerm_key_vault_secret.key_vault_cucumber_token.value,
"SLACK_WEBHOOK_URL": data.azurerm_key_vault_secret.key_vault_slack_webhook_url.value
}
}

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>it.gov.pagopa</groupId>
<artifactId>nodoretodatastore</artifactId>
<version>0.1.4</version>
<version>0.1.4-2-add-notification-webhook</version>
<packaging>jar</packaging>

<name>Nodo RE to datastore Fn</name>
Expand Down

0 comments on commit 2bf9e49

Please sign in to comment.