Skip to content

Commit

Permalink
Merge pull request #106 from pagopa/release-gha
Browse files Browse the repository at this point in the history
new pipelines
  • Loading branch information
jacopocarlini authored May 15, 2024
2 parents 3037bb7 + b90efcb commit 4f016d7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 20 deletions.
18 changes: 11 additions & 7 deletions .devops/deploy-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -164,4 +168,4 @@ stages:
ResourceGroupName: $(RESOURCE_GROUP)
SourceSlot: staging
SwapWithProduction: true
Slot: production
Slot: production
31 changes: 18 additions & 13 deletions .github/workflows/release-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -58,7 +60,7 @@ jobs:
uses: pagopa/github-actions-template/[email protected]

- 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
Expand All @@ -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:
Expand Down Expand Up @@ -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' }}
Expand All @@ -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 ]
Expand All @@ -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/[email protected]
with:
Expand All @@ -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"}'

Expand All @@ -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 }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

0 comments on commit 4f016d7

Please sign in to comment.