DRAFT: Simplify builds #1121
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: radix-operator-pr | |
on: | |
pull_request: | |
branches: | |
- master | |
permissions: | |
id-token: write | |
jobs: | |
build-operator: | |
name: Build-operator | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- uses: azure/login@v1 | |
with: | |
client-id: 6e96429a-3ad5-40ee-b961-6de864d878fc | |
tenant-id: 3aa4a235-b6e2-48d5-9195-7fcf05b459b0 | |
subscription-id: 16ede44b-1f74-40a5-b428-46cca9a5741b | |
- name: Get GitHub Public IP | |
id: github_public_ip | |
run: echo "ipv4=$(curl 'https://ifconfig.me/ip')" >> $GITHUB_OUTPUT | |
- name: Add GitHub IP to ACR | |
id: update_firewall | |
run: az acr network-rule add --name radixdev --ip-address ${{ steps.github_public_ip.outputs.ipv4 }} --query provisioningState && sleep 60 | |
- uses: azure/login@v1 | |
with: | |
client-id: 6e96429a-3ad5-40ee-b961-6de864d878fc | |
tenant-id: 3aa4a235-b6e2-48d5-9195-7fcf05b459b0 | |
subscription-id: 16ede44b-1f74-40a5-b428-46cca9a5741b | |
- name: ACR Login | |
run: 'az acr login --name radixdev --subscription 16ede44b-1f74-40a5-b428-46cca9a5741b' | |
- name: Create tag | |
id: tag | |
env: | |
GITHUB_SHA: ${{github.sha}} | |
run: | | |
sha=${GITHUB_SHA::8} | |
ts=$(date +%s) | |
build_id=nightly-${sha}-${ts} | |
echo "tag=${build_id}" >> $GITHUB_OUTPUTS | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
file: operator.Dockerfile | |
tags: radixdev.azurecr.io/radix-operator-test:${{ steps.tag.outputs.tag }} | |
cache-from: type=registry,ref=radixdev.azurecr.io/radix-operator-test:buildcache | |
cache-to: type=registry,ref=radixdev.azurecr.io/radix-operator-test:buildcache,mode=max | |
- name: Revoke GitHub IP on StorageAccount | |
if: success() || steps.update_firewall.conclusion == 'success' | |
run: az acr network-rule remove --name radixdev --ip-address ${{ steps.github_public_ip.outputs.ipv4 }} --query provisioningState | |
build-pipeline: | |
name: Build-pipeline | |
runs-on: ubuntu-latest | |
if: false | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- uses: azure/login@v1 | |
with: | |
client-id: 6e96429a-3ad5-40ee-b961-6de864d878fc | |
tenant-id: 3aa4a235-b6e2-48d5-9195-7fcf05b459b0 | |
subscription-id: 16ede44b-1f74-40a5-b428-46cca9a5741b | |
- name: Get GitHub Public IP | |
id: github_public_ip | |
run: echo "ipv4=$(curl 'https://ifconfig.me/ip')" >> $GITHUB_OUTPUT | |
- name: Add GitHub IP to StorageAccount | |
run: az acr network-rule add --name radixdev --ip-address ${{ steps.github_public_ip.outputs.ipv4 }} --query provisioningState | |
- name: ACR Login | |
run: 'az acr login --name radixdev --subscription 16ede44b-1f74-40a5-b428-46cca9a5741b' | |
- name: Create tag | |
id: tag | |
env: | |
GITHUB_SHA: ${{github.sha}} | |
run: | | |
sha=${GITHUB_SHA::8} | |
ts=$(date +%s) | |
build_id=${GITHUB_REF_NAME}-${sha}-${ts} | |
echo "IMAGE_TAG=$build_id" >> $GITHUB_OUTPUTS | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
file: pipeline.Dockerfile | |
tags: | | |
radixdev.azurecr.io/radix-pipeline-test:${{ steps.tag.outputs.IMAGE_TAG }} | |
cache-from: type=registry,ref=radixdev.azurecr.io/radix-pipeline-test:buildcache | |
cache-to: type=registry,ref=radixdev.azurecr.io/radix-pipeline-test:buildcache,mode=max | |
- name: Revoke GitHub IP on StorageAccount | |
run: az acr network-rule remove --name radixdev --ip-address ${{ steps.github_public_ip.outputs.ipv4 }} --query provisioningState | |