Sign inSign up

aligent/azure-microservice-deploy-pipe

By aligent

•Updated 23 days ago

Image
0

1.2K

aligent/azure-microservice-deploy-pipe repository overview

⁠Aligent Azure Microservice Deploy Pipe

This pipe is used to deploy Aligent Azure Microservice application.

⁠Prerequisite

  • Create an Azure Service Principal with Contributor role, and store its login details with the below names:

    • ARM_CLIENT_ID: appId
    • ARM_CLIENT_SECRET: password
    • ARM_TENANT_ID: tenant
  • Create pipeline environment variables to use while deploy:

    • BICEP_MAIN_PATH: bicep/main.bicep
    • BICEP_DEFAULT_PARAMETERS_PATH: bicep/main.parameters.json
    • ENVIRONMENT: dev
    • LOCATION: Australia Southeast

⁠YAML Definition

Sample bitbucket-pipelines.yml:

image:
    name: aligent/azure-microservice-deploy-pipe:latest

definitions:
    steps:
        - step: &test
              name: Test
              script:
                  - npm ci
                  # - npm run lint
                  # - npm run test
        - step: &deploy
              script:
                  - az login --service-principal -u '${ARM_CLIENT_ID}' -p '${ARM_CLIENT_SECRET}' --tenant '${ARM_TENANT_ID}'
                  - DEPLOYMENT_NAME=pipe-$(date +%s)
                  - az deployment sub create --name ${DEPLOYMENT_NAME} --location ${LOCATION} --template-file '${BICEP_MAIN_PATH}' --parameters '${BICEP_DEFAULT_PARAMETERS_PATH}' --parameters env='${ENVIRONMENT} --output none'
                  - DEPLOYMENT_OUTPUTS=$(az deployment sub show --name ${DEPLOYMENT_NAME} --query properties.outputs)
                  # The outputs are defined in `main.bicep` file.
                  # The line below assume that we defined an output named `function_app_name`
                  - FUNCTION_APP_NAME=$(echo ${DEPLOYMENT_OUTPUTS} | jq -r '.function_app_name.value')
                  # Run!
                  - npm ci && npm run deploy ${FUNCTION_APP_NAME} -- --typescript
pipelines:
    pull-requests:
        '**':
            - step: *test
    branches:
        staging:
            - step:
                  <<: *deploy
                  name: 'Deploy Staging'
                  deployment: Staging
        master:
            - step:
                  <<: *deploy
                  name: 'Deploy master'
                  deployment: Production

⁠Ref:

Tag summary

Content type

Image

Digest

sha256:80749f2ea…

Size

328.2 MB

Last updated

23 days ago

docker pull aligent/azure-microservice-deploy-pipe