generated from pagopa/pagopa-functions-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from pagopa/integration-test-branch
feat: Add integration test [PAGOPA-959]
- Loading branch information
Showing
43 changed files
with
2,137 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: Integration Tests | ||
|
||
on: | ||
schedule: | ||
- cron: '00 08 * * 2' | ||
|
||
workflow_dispatch: | ||
inputs: | ||
environment: | ||
required: true | ||
type: choice | ||
description: Select the Environment | ||
options: | ||
- dev | ||
- uat | ||
default: uat | ||
canary: | ||
description: 'run the tests on canary version' | ||
required: false | ||
type: boolean | ||
default: false | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
deployments: write | ||
|
||
|
||
jobs: | ||
integration_test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
environment: ${{(github.event.inputs == null && 'uat') || inputs.environment }} | ||
steps: | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@1f9a0c22da41e6ebfa534300ef656657ea2c6707 | ||
|
||
- name: Run Integration Tests | ||
shell: bash | ||
run: | | ||
export CANARY=${{ inputs.canary }} | ||
export REPORTING_BATCH_QUEUE=${{ vars.REPORTING_BATCH_QUEUE }} | ||
export FLOW_SA_CONNECTION_STRING="${{ secrets.FLOW_SA_CONNECTION_STRING }}" | ||
cd ./integration-test | ||
chmod +x ./run_integration_test.sh | ||
./run_integration_test.sh ${{( github.event.inputs == null && 'uat') || inputs.environment }} ${{ secrets.API_SUBSCRIPTION_KEY }} | ||
notify: | ||
needs: [ integration_test ] | ||
runs-on: ubuntu-latest | ||
name: Notify | ||
if: always() | ||
steps: | ||
- name: Report Status | ||
if: always() | ||
uses: ravsamhq/notify-slack-action@v2 | ||
with: | ||
status: ${{ needs.integration_test.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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
data "azurerm_resource_group" "dashboards" { | ||
name = "dashboards" | ||
} | ||
|
||
data "azurerm_kubernetes_cluster" "aks" { | ||
name = local.aks_cluster.name | ||
resource_group_name = local.aks_cluster.resource_group_name | ||
} | ||
|
||
data "github_organization_teams" "all" { | ||
root_teams_only = true | ||
summary_only = true | ||
} | ||
|
||
data "azurerm_key_vault" "key_vault" { | ||
name = "pagopa-${var.env_short}-kv" | ||
resource_group_name = "pagopa-${var.env_short}-sec-rg" | ||
} | ||
|
||
data "azurerm_key_vault" "domain_key_vault" { | ||
name = "pagopa-${var.env_short}-${local.domain}-kv" | ||
resource_group_name = "pagopa-${var.env_short}-${local.domain}-sec-rg" | ||
} | ||
|
||
data "azurerm_key_vault_secret" "key_vault_sonar" { | ||
name = "sonar-token" | ||
key_vault_id = data.azurerm_key_vault.key_vault.id | ||
} | ||
|
||
data "azurerm_key_vault_secret" "key_vault_bot_token" { | ||
name = "bot-token-github" | ||
key_vault_id = data.azurerm_key_vault.key_vault.id | ||
} | ||
|
||
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 | ||
} | ||
|
||
data "azurerm_key_vault_secret" "flow_sa_connection_string" { | ||
name = "flows-sa-${var.env_short}-connection-string" | ||
key_vault_id = data.azurerm_key_vault.domain_key_vault.id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#module "github_runner_app" { | ||
# source = "git::https://github.com/pagopa/github-actions-tf-modules.git//app-github-runner-creator?ref=main" | ||
# | ||
# app_name = local.app_name | ||
# | ||
# subscription_id = data.azurerm_subscription.current.id | ||
# | ||
# github_org = local.github.org | ||
# github_repository = local.github.repository | ||
# github_environment_name = var.env | ||
# | ||
# container_app_github_runner_env_rg = local.container_app_environment.resource_group | ||
#} | ||
# | ||
#resource "null_resource" "github_runner_app_permissions_to_namespace" { | ||
# triggers = { | ||
# aks_id = data.azurerm_kubernetes_cluster.aks.id | ||
# service_principal_id = module.github_runner_app.client_id | ||
# namespace = local.domain | ||
# version = "v2" | ||
# } | ||
# | ||
# provisioner "local-exec" { | ||
# command = <<EOT | ||
# az role assignment create --role "Azure Kubernetes Service RBAC Admin" \ | ||
# --assignee ${self.triggers.service_principal_id} \ | ||
# --scope ${self.triggers.aks_id}/namespaces/${self.triggers.namespace} | ||
# | ||
# az role assignment list --role "Azure Kubernetes Service RBAC Admin" \ | ||
# --scope ${self.triggers.aks_id}/namespaces/${self.triggers.namespace} | ||
# EOT | ||
# } | ||
# | ||
# provisioner "local-exec" { | ||
# when = destroy | ||
# command = <<EOT | ||
# az role assignment delete --role "Azure Kubernetes Service RBAC Admin" \ | ||
# --assignee ${self.triggers.service_principal_id} \ | ||
# --scope ${self.triggers.aks_id}/namespaces/${self.triggers.namespace} | ||
# EOT | ||
# } | ||
#} | ||
# | ||
#resource "azurerm_role_assignment" "environment_terraform_resource_group_dashboards" { | ||
# scope = data.azurerm_resource_group.dashboards.id | ||
# role_definition_name = "Contributor" | ||
# principal_id = module.github_runner_app.object_id | ||
#} | ||
# | ||
#resource "azurerm_role_assignment" "environment_key_vault" { | ||
# scope = data.azurerm_key_vault.key_vault.id | ||
# role_definition_name = "Reader" | ||
# principal_id = module.github_runner_app.object_id | ||
#} | ||
# | ||
#resource "azurerm_role_assignment" "environment_key_vault_domain" { | ||
# scope = data.azurerm_key_vault.domain_key_vault.id | ||
# role_definition_name = "Reader" | ||
# principal_id = module.github_runner_app.object_id | ||
#} | ||
# | ||
#resource "azurerm_key_vault_access_policy" "ad_kv_group_policy" { | ||
# key_vault_id = data.azurerm_key_vault.key_vault.id | ||
# | ||
# tenant_id = data.azurerm_client_config.current.tenant_id | ||
# object_id = module.github_runner_app.object_id | ||
# | ||
# key_permissions = [] | ||
# secret_permissions = ["Get", "List"] | ||
# storage_permissions = [] | ||
# certificate_permissions = [] | ||
#} | ||
# | ||
#resource "azurerm_key_vault_access_policy" "ad_domain_kv_group_policy" { | ||
# key_vault_id = data.azurerm_key_vault.domain_key_vault.id | ||
# | ||
# tenant_id = data.azurerm_client_config.current.tenant_id | ||
# object_id = module.github_runner_app.object_id | ||
# | ||
# key_permissions = [] | ||
# secret_permissions = ["Get", "List"] | ||
# storage_permissions = [] | ||
# certificate_permissions = [] | ||
#} |
Oops, something went wrong.