From b90efcb76f098af2c35cd5f3cf8a1375fc79c9f4 Mon Sep 17 00:00:00 2001 From: Jacopo Date: Wed, 15 May 2024 14:21:00 +0200 Subject: [PATCH] new pipelines --- .devops/deploy-pipelines.yml | 18 +++++++++------- .github/workflows/release-deploy.yml | 31 ++++++++++++++++------------ 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/.devops/deploy-pipelines.yml b/.devops/deploy-pipelines.yml index a7773fc..49a55d2 100644 --- a/.devops/deploy-pipelines.yml +++ b/.devops/deploy-pipelines.yml @@ -8,7 +8,7 @@ parameters: - uat - prod - name: SEMVER - displayName: "When packing a release, define the version bump to apply. Use only buildNumber or skip for manual deployment" + displayName: "When packing a release, define the version bump to apply. Use only buildNumber or skip for manual deployment" - name: DOCKERFILE displayName: Dockerfile path type: string @@ -26,29 +26,32 @@ parameters: - node - java - name: APP_SERVICE_NAME - displayName: App Serivce Name Image Name + displayName: App Service Name Image Name type: string + - name: APP_SERVICE_RESOURCE_GROUP + displayName: App Service Resource Group + type: string + - variables: ${{ if eq(parameters['ENV'], 'dev') }}: AZURE_SUBSCRIPTION: $(DEV_AZURE_SUBSCRIPTION) - RESOURCE_GROUP: $(DEV_WEB_APP_RESOURCE_GROUP_NAME) + # RESOURCE_GROUP: $(DEV_WEB_APP_RESOURCE_GROUP_NAME) # APP_NAME: $(DEV_WEB_APP_NAME) STAGE: "d" dockerRegistryServiceConnection: $(DEV_CONTAINER_REGISTRY_SERVICE_CONN) dockerNamespace: $(DEV_CONTAINER_NAMESPACE) ${{ if eq(parameters['ENV'], 'uat') }}: AZURE_SUBSCRIPTION: $(UAT_AZURE_SUBSCRIPTION) - RESOURCE_GROUP: $(UAT_WEB_APP_RESOURCE_GROUP_NAME) + # RESOURCE_GROUP: $(UAT_WEB_APP_RESOURCE_GROUP_NAME) # APP_NAME: $(UAT_WEB_APP_NAME) STAGE: "u" dockerRegistryServiceConnection: $(UAT_CONTAINER_REGISTRY_SERVICE_CONN) dockerNamespace: $(UAT_CONTAINER_NAMESPACE) ${{ if eq(parameters['ENV'], 'prod') }}: AZURE_SUBSCRIPTION: $(PROD_AZURE_SUBSCRIPTION) - RESOURCE_GROUP: $(PROD_WEB_APP_RESOURCE_GROUP_NAME) + # RESOURCE_GROUP: $(PROD_WEB_APP_RESOURCE_GROUP_NAME) # APP_NAME: $(PROD_WEB_APP_NAME) STAGE: "p" dockerRegistryServiceConnection: $(PROD_CONTAINER_REGISTRY_SERVICE_CONN) @@ -64,6 +67,7 @@ variables: APP_NAME: ${{ parameters.APP_SERVICE_NAME }} IMAGE_REPOSITORY: ${{ parameters.IMAGE_NAME }} + RESOURCE_GROUP: ${{ parameters.APP_SERVICE_RESOURCE_GROUP }} # Only manual triggers trigger: none @@ -164,4 +168,4 @@ stages: ResourceGroupName: $(RESOURCE_GROUP) SourceSlot: staging SwapWithProduction: true - Slot: production \ No newline at end of file + Slot: production diff --git a/.github/workflows/release-deploy.yml b/.github/workflows/release-deploy.yml index c161837..c794d8b 100644 --- a/.github/workflows/release-deploy.yml +++ b/.github/workflows/release-deploy.yml @@ -2,11 +2,6 @@ name: Release And Deploy # Controls when the workflow will run on: - pull_request: - branches: - - main - types: [ closed ] - # Allows you to run this workflow manually from the Actions tab workflow_dispatch: inputs: @@ -19,6 +14,13 @@ on: - uat - prod - all + domain: + required: true + type: choice + description: Select the domain + options: + - weu-shared + - itn-printit semver: required: true type: choice @@ -58,7 +60,7 @@ jobs: uses: pagopa/github-actions-template/semver-setup@v1.4.2 - if: ${{ github.event.inputs.environment == null || github.event.inputs.environment == 'dev' }} - run: echo "ENVIRNOMENT=dev" >> $GITHUB_ENV + run: echo "ENVIRNOMENT=dev" >> $GITHUB_ENV - if: ${{ github.event.inputs.environment == 'uat' }} run: echo "ENVIRNOMENT=uat" >> $GITHUB_ENV @@ -78,7 +80,7 @@ jobs: release: name: Create a New Release runs-on: ubuntu-latest - needs: [setup] + needs: [ setup ] outputs: version: ${{ steps.release.outputs.version }} steps: @@ -113,7 +115,7 @@ jobs: runs-on: ubuntu-latest steps: - if: ${{ github.event.inputs.environment == null || github.event.inputs.environment == 'dev' }} - run: echo "SHORT_ENV=d" >> $GITHUB_ENV + run: echo "SHORT_ENV=d" >> $GITHUB_ENV - if: ${{ github.event.inputs.environment == 'uat' }} run: echo "SHORT_ENV=u" >> $GITHUB_ENV - if: ${{ github.event.inputs.environment == 'prod' }} @@ -133,10 +135,12 @@ jobs: "BUILD_CONTEXT": "./node", "IMAGE_NAME": "pagopapdfengine", "TYPE": "node", - "APP_SERVICE_NAME": "pagopa-${{ env.SHORT_ENV }}-weu-shared-app-pdf-engine" + "APP_SERVICE_NAME": "pagopa-${{ env.SHORT_ENV }}-${{inputs.domain}}-app-pdf-engine", + "APP_SERVICE_RESOURCE_GROUP": "pagopa-${{ env.SHORT_ENV }}-${{inputs.domain}}-pdf-engine-rg" } azure-pipeline-variables: '{"system.debug": "true"}' + deploy_app_service_java: # needs: [ setup, release, image, deploy_app_service_node ] needs: [ setup, release, deploy_app_service_node ] @@ -145,12 +149,12 @@ jobs: runs-on: ubuntu-latest steps: - if: ${{ github.event.inputs.environment == null || github.event.inputs.environment == 'dev' }} - run: echo "SHORT_ENV=d" >> $GITHUB_ENV + run: echo "SHORT_ENV=d" >> $GITHUB_ENV - if: ${{ github.event.inputs.environment == 'uat' }} run: echo "SHORT_ENV=u" >> $GITHUB_ENV - if: ${{ github.event.inputs.environment == 'prod' }} run: echo "SHORT_ENV=p" >> $GITHUB_ENV - + - name: Azure Pipelines Action uses: jacopocarlini/azure-pipelines@v1.3 with: @@ -165,7 +169,8 @@ jobs: "BUILD_CONTEXT": ".", "IMAGE_NAME": "pagopapdfenginejava", "TYPE": "java", - "APP_SERVICE_NAME": "pagopa-${{ env.SHORT_ENV }}-weu-shared-app-pdf-engine-java" + "APP_SERVICE_NAME": "pagopa-${{ env.SHORT_ENV }}-${{inputs.domain}}-app-pdf-engine-java", + "APP_SERVICE_RESOURCE_GROUP": "pagopa-${{ env.SHORT_ENV }}-${{inputs.domain}}-pdf-engine-rg" } azure-pipeline-variables: '{"system.debug": "true"}' @@ -186,4 +191,4 @@ jobs: 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 }} \ No newline at end of file + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}