Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added Slack notification #18

Merged
merged 6 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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