-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
713 additions
and
193 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
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
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,3 @@ | ||
FROM hub.docker.com/library/nginx:1.23-alpine | ||
|
||
COPY index.html /usr/share/nginx/html/ |
47 changes: 47 additions & 0 deletions
47
example/azure-pipelines/build-container-buildctl/azure-pipelines.yaml
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,47 @@ | ||
# Use ARM64 Linux agents because they are cheap | ||
pool: | ||
name: onprem_aks | ||
demands: | ||
- flavor_bullseye | ||
- nested_virtualization | ||
|
||
trigger: | ||
- "*" | ||
|
||
variables: | ||
- name: branch_sanitized | ||
value: ${{ replace(replace(replace(variables['Build.SourceBranch'], 'refs/heads/', ''), '/', '-'), '_', '-') }} | ||
- name: container_name | ||
value: my-app | ||
- name: container_registry_service_connection | ||
value: my-app-registry | ||
- name: container_registry_domain | ||
value: my-app-registry.azurecr.io | ||
|
||
stages: | ||
- stage: build | ||
displayName: Build | ||
jobs: | ||
- job: build | ||
displayName: Build | ||
steps: | ||
- template: step-checkout.yaml | ||
|
||
- template: step-setup-docker.yaml | ||
|
||
- task: Docker@2 | ||
displayName: Login to ACR | ||
inputs: | ||
command: login | ||
containerRegistry: $(container_registry_service_connection) | ||
|
||
- bash: | | ||
buildctl build \ | ||
--export-cache type=inline \ | ||
--frontend dockerfile.v0 \ | ||
--import-cache type=registry,ref=$(container_registry_domain)/$(container_name):$(branch_sanitized) \ | ||
--local context=. \ | ||
--local dockerfile=. \ | ||
--opt platform=linux/amd64,linux/arm64/v8 \ | ||
--output type=image,\"name=$(container_registry_domain)/$(container_name):latest,$(container_registry_domain)/$(container_name):$(branch_sanitized)\",push=true | ||
displayName: Build the image |
10 changes: 10 additions & 0 deletions
10
example/azure-pipelines/build-container-buildctl/index.html
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,10 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Page Title</title> | ||
</head> | ||
<body> | ||
<h1>Hello World!</h1> | ||
<p>This is a super small HTML page.</p> | ||
</body> | ||
</html> |
30 changes: 30 additions & 0 deletions
30
example/azure-pipelines/build-container-buildctl/step-setup-kubectl.yaml
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,30 @@ | ||
steps: | ||
- task: KubectlInstaller@0 | ||
inputs: | ||
# https://github.com/kubernetes/kubectl/releases | ||
kubectlVersion: 1.26.3 | ||
|
||
- bash: | | ||
ARCH=$(ARCH_X64=amd64 bash cicd/arch.sh) | ||
# Install | ||
mkdir -p "$(Agent.TempDirectory)/kubelogin" | ||
cd "$(Agent.TempDirectory)/kubelogin" | ||
curl -LsSf https://github.com/Azure/kubelogin/releases/download/v${KUBELOGIN_VERSION}/kubelogin-linux-${ARCH}.zip -o kubelogin.zip | ||
unzip kubelogin.zip -d . | ||
mkdir -p /usr/local/kubelogin/bin | ||
mv bin/linux_${ARCH}/kubelogin /usr/local/kubelogin/bin/kubelogin | ||
ln -s /usr/local/kubelogin/bin/kubelogin /usr/local/bin | ||
# Test the install | ||
kubelogin --version | ||
displayName: Setup Kubelogin | ||
env: | ||
# https://github.com/Azure/kubelogin/releases | ||
KUBELOGIN_VERSION: 0.0.28 | ||
- task: HelmInstaller@1 | ||
displayName: Setup Helm | ||
inputs: | ||
# https://github.com/helm/helm/releases | ||
helmVersionToInstall: 3.11.2 |
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 |
---|---|---|
@@ -1,17 +1,16 @@ | ||
pipelines: | ||
pat: ojemi3pd7adocbqeeuzr5o7ldz2jlwxxbmtrrj7gq5mifhmafpsa | ||
pool: onprem_aks | ||
url: https://dev.azure.com/shopping-cart-devops-demo | ||
cacheType: azurefile-csi | ||
capabilities: | ||
- arch_arm64 | ||
|
||
affinity: | ||
nodeAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: kubernetes.io/arch | ||
operator: In | ||
values: | ||
- arm64 | ||
- key: kubernetes.io/arch | ||
operator: In | ||
values: | ||
- arm64 | ||
|
||
pipelines: | ||
capabilities: | ||
- arch_arm64 | ||
pat: your-pat | ||
pool: private_kube | ||
url: https://dev.azure.com/shopping-cart-devops-demo |
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,29 @@ | ||
annotations: | ||
container.apparmor.security.beta.kubernetes.io/azp-agent: unconfined | ||
|
||
extraVolumeMounts: | ||
- mountPath: /home/root/.local/share/buildkit | ||
name: buildkitd | ||
|
||
extraVolumes: | ||
- emptyDir: {} | ||
name: buildkitd | ||
|
||
securityContext: | ||
seccompProfile: | ||
type: Unconfined | ||
|
||
resources: | ||
limits: | ||
cpu: 4 | ||
memory: 8Gi | ||
requests: | ||
cpu: 2 | ||
memory: 4Gi | ||
|
||
pipelines: | ||
capabilities: | ||
- buildkit | ||
pat: your-pat | ||
pool: private_kube | ||
url: https://dev.azure.com/shopping-cart-devops-demo |
Oops, something went wrong.