generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pipeline for Azure community gallery image publishing
- Loading branch information
Showing
17 changed files
with
453 additions
and
495 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Required pipeline variables: | ||
# - BUILD_POOL - Azure DevOps build pool to use | ||
# - AZURE_TENANT_ID - tenant ID | ||
# - AZURE_CLIENT_ID - service principal ID | ||
# - AZURE_CLIENT_SECRET - service principal secret | ||
# - AZURE_SUBSCRIPTION_ID - subscription ID | ||
# - KUBERNETES_VERSION - version of Kubernetes to build the image with, e.g. `1.31.1` | ||
# - OS - operating system distro, such as 'Ubuntu', 'AzureLinux', or `Windows` | ||
# - OS_VERSION - version of distro, such as `24.04` or `2022-containerd` | ||
# - RESOURCE_GROUP - name of the Azure resource group to use for the compute galleries | ||
# - STAGING_GALLERY_NAME - name of the Azure compute gallery for initial image publishing | ||
|
||
jobs: | ||
- job: build_sig | ||
timeoutInMinutes: 120 | ||
strategy: | ||
maxParallel: 0 | ||
pool: | ||
name: $(BUILD_POOL) | ||
steps: | ||
- template: k8s-config.yaml | ||
- script: | | ||
set -euo pipefail | ||
[[ -n ${DEBUG:-} ]] && set -o xtrace | ||
kube_proxy_url="sigwindowstools/kube-proxy:v${KUBERNETES_VERSION/+/_}-calico-hostprocess" | ||
echo "Checking for Windows kube-proxy image $kube_proxy_url" | ||
if ! stderr="$(docker pull $kube_proxy_url 2>&1 > /dev/null)"; then | ||
# It's a Windows image, so expect an error after pulling it on Linux | ||
if [[ $stderr != *"cannot be used on this platform"* ]]; then | ||
echo "Failed to pull kube-proxy image: $stderr" | ||
exit 1 | ||
fi | ||
fi | ||
displayName: Check for Windows kube-proxy image | ||
condition: and(eq(variables['PREFLIGHT_CHECKS'], 'true'), eq(variables['OS'], 'Windows')) | ||
- script: | | ||
set -euo pipefail | ||
[[ -n ${DEBUG:-} ]] && set -o xtrace | ||
# Generate locales properly on Azure Linux or ansible will complain | ||
sudo tdnf -y install glibc-i18n | ||
sudo locale-gen.sh | ||
export LC_ALL=en_US.UTF-8 | ||
export PATH=$PATH:$HOME/.local/bin | ||
os=$(echo "${OS}" | tr '[:upper:]' '[:lower:]') | ||
version=$(echo "${OS_VERSION}" | tr '[:upper:]' '[:lower:]' | tr -d .) | ||
export RESOURCE_GROUP="${RESOURCE_GROUP:-cluster-api-gallery}" | ||
export RESOURCE_GROUP_NAME="${RESOURCE_GROUP}" | ||
export SIG_OFFER="reference-images" | ||
# timestamp is in RFC-3339 format to match kubetest | ||
export TIMESTAMP="$(date -u '+%Y-%m-%dT%H:%M:%SZ')" | ||
export JOB_NAME="${JOB_NAME:-"image-builder-sig-${os}-${version}"}" | ||
export TAGS="${TAGS:-creationTimestamp=${TIMESTAMP} jobName=${JOB_NAME} DO-NOT-DELETE=UpstreamInfra}" | ||
printf "${TAGS}" | tee packer/azure/tags.out | ||
export GALLERY_NAME="${STAGING_GALLERY_NAME:-staging_gallery}" | ||
DISTRO="${os}-${version}" | ||
echo "##vso[task.setvariable variable=DISTRO]$DISTRO" | ||
# Add build tags in ADO | ||
echo "##vso[build.addbuildtag]$KUBERNETES_VERSION" | ||
echo "##vso[build.addbuildtag]$DISTRO" | ||
export PACKER_FLAGS="${PACKER_FLAGS} --var sig_image_version=${KUBERNETES_VERSION}" | ||
make build-azure-sig-$os-$version | tee packer/azure/packer.out | ||
displayName: Build SIG Image | ||
workingDirectory: '$(system.defaultWorkingDirectory)/images/capi' | ||
env: | ||
AZURE_CLIENT_SECRET: $(AZURE_CLIENT_SECRET) | ||
- template: sig-publishing-info.yaml | ||
- task: PublishPipelineArtifact@1 | ||
inputs: | ||
artifact: 'publishing-info' | ||
path: '$(system.defaultWorkingDirectory)/images/capi/packer/azure/sig-publishing-info.json' |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
images/capi/packer/azure/.pipelines/create-disk-version.yaml
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
images/capi/packer/azure/.pipelines/delete-storage-account.yaml
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.