-
Notifications
You must be signed in to change notification settings - Fork 1
/
azure-pipelines.yml
45 lines (38 loc) · 1.61 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
trigger: none
pool:
vmImage: 'ubuntu-latest'
variables:
AZURE_CONTAINER_APP_NAME: 'gateway-global-integration-api-iac'
RESOURCE_GROUP: 'Gateway-Resources-IAC'
DOCKER_IMAGE: 'attonbomb/gateway-global-integration-api:latest' # Replace with your Docker Hub image path
AZURE_SUBSCRIPTION: 'Gateway-Resources-IAC-MI-Conn-2'
steps:
- task: Docker@2
inputs:
command: 'login'
containerRegistry: 'attonbomb-DockerHub-SC'
# Set the Azure subscription based on the branch
- script: |
echo "Determining Azure subscription..."
if [ "$(Build.SourceBranchName)" = "development" ]; then
echo "##vso[task.setvariable variable=AZURE_SUBSCRIPTION]Dev-Gateway-Resources-MS"
echo "##vso[task.setvariable variable=DOCKER_IMAGE]attonbomb/gateway-global-integration-api:dev"
else
echo "##vso[task.setvariable variable=AZURE_SUBSCRIPTION]Gateway-Resources-IAC-MI-Conn-2"
fi
displayName: 'Set Azure Subscription'
- task: AzureCLI@2
inputs:
azureSubscription: $(AZURE_SUBSCRIPTION)
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
echo "Updating Azure Container App with the latest image"
az config set extension.use_dynamic_install=yes_without_prompt
# Update the Azure Container App to pull the latest image
az containerapp update \
--name gateway-global-integration-api-iac \
--resource-group Gateway-IAC-Resources \
--image $(DOCKER_IMAGE) \
--registry-server hub.docker.com
echo "Global Integration API Container App updated successfully"