Skip to content

Commit ae5cce9

Browse files
committed
Minor fixes
Signed-off-by: michaelawyu <[email protected]>
1 parent dc83497 commit ae5cce9

File tree

1 file changed

+95
-14
lines changed

1 file changed

+95
-14
lines changed

.github/workflows/build-publish-mcr.yml

Lines changed: 95 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33

44
name: Building and Pushing to MCR
55
on:
6-
pull_request:
7-
branches:
8-
- main
6+
workflow_dispatch:
7+
inputs:
8+
releaseTag:
9+
description: 'Release tag to publish images, defaults to the latest one'
10+
type: string
911

1012
permissions:
1113
id-token: write
@@ -52,6 +54,59 @@ jobs:
5254
# NOTE: As exporting a variable from a secret is not possible, the shared variable registry obtained
5355
# from AZURE_REGISTRY secret is not exported from here.
5456
57+
publish-images-amd64:
58+
runs-on:
59+
labels: [self-hosted, "1ES.Pool=1es-aks-fleet-pool-ubuntu"]
60+
needs: prepare-variables
61+
steps:
62+
- uses: actions/checkout@v5
63+
with:
64+
ref: ${{ needs.prepare-variables.outputs.release_tag }}
65+
- name: 'Login the ACR'
66+
run: |
67+
az login --identity
68+
az acr login -n ${{ secrets.AZURE_REGISTRY }}
69+
- name: Build and publish hub-agent
70+
run: |
71+
make docker-build-hub-agent
72+
env:
73+
HUB_AGENT_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}-amd64
74+
REGISTRY: ${{ secrets.AZURE_REGISTRY }}/${{ env.REGISTRY_REPO}}
75+
- name: Build and publish member-agent
76+
run: |
77+
make docker-build-member-agent
78+
env:
79+
MEMBER_AGENT_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}-amd64
80+
REGISTRY: ${{ secrets.AZURE_REGISTRY }}/${{ env.REGISTRY_REPO}}
81+
- name: Build and publish refresh-token
82+
run: |
83+
make docker-build-refresh-token
84+
env:
85+
REFRESH_TOKEN_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}-amd64
86+
REGISTRY: ${{ secrets.AZURE_REGISTRY }}/${{ env.REGISTRY_REPO}}
87+
- name: Build and publish crd-installer
88+
run: |
89+
make docker-build-crd-installer
90+
env:
91+
CRD_INSTALLER_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}-amd64
92+
REGISTRY: ${{ secrets.AZURE_REGISTRY }}/${{ env.REGISTRY_REPO}}
93+
# Build Arc Extension for member clusters
94+
# Arc-connected clusters can join fleets as member clusters through an Arc Extension.
95+
# An Arc Extension is a packaged Helm chart that gets deployed to Arc clusters.
96+
# This step packages both the fleet member agent and networking agents into a single
97+
# Helm chart for Arc deployment, since Arc Extensions require all components to be bundled together.
98+
- name: Build and publish ARC member cluster agents helm chart
99+
run: |
100+
make helm-package-arc-member-cluster-agents
101+
env:
102+
ARC_MEMBER_AGENT_HELMCHART_VERSION: ${{ needs.prepare-variables.outputs.arc_helmchart_version }}
103+
MEMBER_AGENT_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}
104+
REFRESH_TOKEN_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}
105+
CRD_INSTALLER_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}
106+
MCS_CONTROLLER_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.fleet_networking_version }}
107+
MEMBER_NET_CONTROLLER_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.fleet_networking_version }}
108+
REGISTRY: ${{ secrets.AZURE_REGISTRY }}/${{ env.ARC_REGISTRY_REPO}}
109+
55110
publish-images-arm64:
56111
runs-on:
57112
labels: [self-hosted, "1ES.Pool=1es-aks-fleet-pool-ubuntu-arm64"]
@@ -65,9 +120,9 @@ jobs:
65120
# install it manually here.
66121
run:
67122
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
68-
- name: 'Set up dependencies'
123+
- name: 'Set up build dependencies'
69124
# Note (chenyu1): the self-hosted 1ES ARM64 pool, for some reason, does not have the common build
70-
# tools (e.g., make) installed by default; install the build-essential meta package to set them up.
125+
# tools (e.g., make) installed by default; install them manually.
71126
run: |
72127
sudo apt-get update
73128
sudo apt-get install -y build-essential acl
@@ -88,29 +143,55 @@ jobs:
88143
sudo apt-get update
89144
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
90145
- name: 'Enable Docker access'
146+
# Note (chenyu1): there are situations where the newgrp command will not take effect; set access
147+
# to the docker daemon directly just in case.
91148
run: |
92149
sudo groupadd docker || true
93150
echo "Adding $USER to the docker group"
94151
sudo usermod -aG docker $USER
95-
groups $USER
96-
whoami
97152
newgrp docker
98153
sudo setfacl --modify user:$USER:rw /var/run/docker.sock
99154
- name: 'Login the ACR'
100-
# Note (chenyu1): must login with root privileges to have Docker access.
155+
# Note (chenyu1): must not use root privileges; the system seems to have some trouble
156+
# retrieving credentials when sudo is used.
101157
run: |
102-
az login --identity
103-
az acr login -n aksmcrimagescommon
158+
sudo az login --identity
159+
sudo az acr login -n ${{ secrets.AZURE_REGISTRY }}
104160
- name: 'Verify Docker CLI'
105161
# Note (chenyu1): the Docker installation has to be invoked with root privileges by default; for
106162
# simplicity reasons in this pipeline we will make no attempt to enable rootless Docker usage.
107163
run: |
108-
docker version
109-
docker info
164+
sudo docker version
165+
sudo docker info
166+
- name: Build and publish hub-agent
167+
# Note (chenyu1): must preserve the environment here.
168+
run: |
169+
sudo -E make docker-build-hub-agent
170+
env:
171+
HUB_AGENT_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}-arm64
172+
REGISTRY: ${{ secrets.AZURE_REGISTRY }}/${{ env.REGISTRY_REPO}}
173+
TARGET_ARCH: arm64
174+
- name: Build and publish member-agent
175+
# Note (chenyu1): must preserve the environment here.
176+
run: |
177+
sudo -E make docker-build-member-agent
178+
env:
179+
MEMBER_AGENT_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}-arm64
180+
REGISTRY: ${{ secrets.AZURE_REGISTRY }}/${{ env.REGISTRY_REPO}}
181+
TARGET_ARCH: arm64
110182
- name: Build and publish refresh-token
183+
# Note (chenyu1): must preserve the environment here.
111184
run: |
112-
make docker-build-refresh-token
185+
sudo -E make docker-build-refresh-token
113186
env:
114187
REFRESH_TOKEN_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}-arm64
115-
REGISTRY: aksmcrimagescommon.azurecr.io/public/aks/fleet
188+
REGISTRY: ${{ secrets.AZURE_REGISTRY }}/${{ env.REGISTRY_REPO}}
116189
TARGET_ARCH: arm64
190+
- name: Build and publish crd-installer
191+
# Note (chenyu1): must preserve the environment here.
192+
run: |
193+
sudo -E make docker-build-crd-installer
194+
env:
195+
CRD_INSTALLER_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}-arm64
196+
REGISTRY: ${{ secrets.AZURE_REGISTRY }}/${{ env.REGISTRY_REPO}}
197+
TARGET_ARCH: arm64

0 commit comments

Comments
 (0)