build and push to acr #18
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build and push to acr | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: 'Environment to build' | |
required: true | |
default: 'development' | |
type: choice | |
options: | |
- development | |
- staging | |
- prod | |
env: | |
runner_base: ${{ vars.RUNNER_BASE_NAME }} | |
permissions: | |
contents: read | |
jobs: | |
docker: | |
strategy: | |
matrix: | |
include: | |
- components: devhostagent | |
imageName: lpkremoteagent | |
- components: devhostagent.restorationjob | |
imageName: lpkrestorationjob | |
- components: routingmanager | |
imageName: routingmanager | |
runs-on: | |
labels: ["self-hosted", "1ES.Pool=$runner_base-ubuntu"] | |
environment: ${{ github.event.inputs.environment }} | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 | |
with: | |
egress-policy: audit | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | |
- name: Authenticate to ACR | |
run : | | |
az login --identity | |
az acr login -n ${{ vars.AZURE_REGISTRY_SERVER }} | |
- name: Set telemetry variables | |
shell: bash | |
run: | | |
if [ $GITHUB_REF == "refs/heads/main" ]; then | |
echo "##vso[task.setvariable variable=TelemetryType]TELEMETRY_PRODUCTION" | |
else | |
echo "##vso[task.setvariable variable=TelemetryType]TELEMETRY_DEVELOPMENT" | |
fi | |
- name: Set image tags | |
shell: bash | |
id: version | |
run: | | |
chmod +x ./deployment/settings/setenvironmentvariables.sh | |
`./deployment/settings/setenvironmentvariables.sh deployment/settings/services/imagetag.setting` | |
printenv | grep "MINDARO" | |
if [ ${{ matrix.components}} == "devhostagent" ]; then | |
echo "tag=$MINDARO_DEVHOSTAGENT_TAG" >> $GITHUB_ENV | |
elif [ ${{ matrix.components}} == "devhostagent.restorationjob" ]; then | |
echo "tag=$MINDARO_DEVHOSTAGENT_RESTORATIONJOB_TAG" >> $GITHUB_ENV | |
else | |
echo "tag=stable" >> $GITHUB_ENV | |
fi | |
- name: Build and push for ${{ matrix.components }} | |
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 | |
with: | |
file: src/${{ matrix.components }}/Dockerfile | |
platforms: linux/arm64,linux/amd64 | |
push: true | |
tags: ${{ vars.AZURE_REGISTRY_SERVER }}/${{ matrix.imageName }}:${{ env.tag }} |