stages.yml 1.77 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
parameters:
  environments: []

stages:
  - ${{ each environment in parameters.environments }}:
    - stage: 'Build_${{ environment.name }}'

      variables:
      - group: 'Infrastructure Pipeline Variables - ${{environment.name}}'
      - group: 'Azure Target Env Secrets - ${{environment.name}}'
      - group: 'Azure Target Env - ${{environment.name}}' 

      jobs:
14
        - deployment: MavenPackageAndPublishArtifacts
15
          displayName: Build Package and Publish Artifacts
16
          environment: ${{ environment.name }}
17
          pool: $(AGENT_POOL)
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
          strategy:
            runOnce:
              deploy:
                  steps:
                  - download: none

                  - checkout: self
                    path: s

                  - task: AzureCLI@1
                    displayName: 'Docker Build + ACR Push'
                    # condition: and(succeeded(), eq('${{ parameters.providerName }}', 'Azure'))
                    env:
                      IMAGE: $(CONTAINER_REGISTRY_NAME).azurecr.io/crs-catalog-data:v2
                    inputs:
                      azureSubscription: '$(SERVICE_CONNECTION_NAME)'
                      addSpnToEnvironment: true
                      scriptLocation: inlineScript
                      inlineScript: |
                        #!/usr/bin/env bash
                        set -euo pipefail

                        curl -L https://aka.ms/acr/installaad/bash | /bin/bash
                        echo "Logging in to the ACR Registry"
                        echo "------------------------------------"
                        az acr login -n $(CONTAINER_REGISTRY_NAME)

                        pushd data
                        docker build -t $IMAGE .
                        docker push $IMAGE
                        popd