Skip to content

Commit 69f9083

Browse files
committed
Edit Pipeline Trigger
1 parent 81351cb commit 69f9083

File tree

57 files changed

+1546
-3678
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1546
-3678
lines changed

.pipelines/OneBranch.NonOfficial.CrossPlat.yaml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.pipelines/OneBranch.Official.CrossPlat.yaml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.pipelines/build/binary.steps.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
parameters:
2+
- name: target
3+
type: string
4+
5+
- name: os
6+
type: string
7+
8+
- name: arch
9+
type: string
10+
11+
12+
steps:
13+
- task: GoTool@0
14+
inputs:
15+
version: '$(GOVERSION)'
16+
17+
- bash: |
18+
sudo apt-get update -y
19+
if [[ $GOARCH =~ amd64 ]]; then
20+
sudo apt-get install -y llvm clang linux-libc-dev linux-headers-generic libbpf-dev libc6-dev nftables iproute2 gcc-multilib
21+
for dir in /usr/include/x86_64-linux-gnu/*; do
22+
sudo ln -sfn "$dir" /usr/include/$(basename "$dir")
23+
done
24+
25+
elif [[ $GOARCH =~ arm64 ]]; then
26+
sudo apt-get install -y llvm clang linux-libc-dev linux-headers-generic libbpf-dev libc6-dev nftables iproute2 gcc-aarch64-linux-gnu
27+
for dir in /usr/include/aarch64-linux-gnu/*; do
28+
sudo ln -sfn "$dir" /usr/include/$(basename "$dir")
29+
done
30+
fi
31+
displayName: "Install Binary Pre-Reqs"
32+
workingDirectory: $(ACN_DIR)
33+
env:
34+
TARGET: ${{ parameters.target }}
35+
GOOS: ${{ parameters.os }}
36+
GOARCH: ${{ parameters.arch }}
37+
38+
- bash: |
39+
make "$TARGET"
40+
ls -la output
41+
displayName: "Build Binary - ${{ parameters.target }}"
42+
workingDirectory: $(ACN_DIR)
43+
env:
44+
TARGET: ${{ parameters.target }}
45+
GOOS: ${{ parameters.os }}
46+
GOARCH: ${{ parameters.arch }}
47+
48+
- script: |
49+
SOURCE_DIR="./output"
50+
TARGET_DIR="$BUILD_ARTIFACTSTAGINGDIRECTORY"/out
51+
mkdir -p "$TARGET_DIR"
52+
find "$SOURCE_DIR" -name '*.tgz*' -print -exec mv -t "$TARGET_DIR"/ {} +
53+
find "$SOURCE_DIR" -name '*.zip' -print -exec mv -t "$TARGET_DIR"/ {} +
54+
ls -la "$TARGET_DIR"
55+
displayName: "Prepare Artifacts"
56+
workingDirectory: $(ACN_DIR)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
parameters:
2+
- name: platforms
3+
type: object
4+
default: []
5+
6+
7+
steps:
8+
- bash: |
9+
set -e
10+
MANIFEST_DATA=$(echo "$IMAGE_PLATFORM_DATA" | \
11+
jq -r '.[] |
12+
.args = [ (.platform | split("/")[0]), (.platform | split("/")[1]) ] |
13+
.args = [ ("--os " + .args[0] ), ("--arch " + .args[1] ) ] |
14+
if .osVersion then .args += ["--os-version " + .osVersion] else . end |
15+
{ image: .imageReference, annotate: .args }' | \
16+
jq -rcs)
17+
echo >&2 "##vso[task.setvariable variable=MANIFEST_JSON;isOutput=true]$MANIFEST_DATA"
18+
echo "$MANIFEST_DATA" | jq -r .
19+
displayName: "Populate Image Manifest Data"
20+
name: data
21+
env:
22+
IMAGE_PLATFORM_DATA: '${{ convertToJson(parameters.platforms) }}'
23+

.pipelines/build/image.steps.yaml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
parameters:
2+
- name: arch
3+
type: string
4+
default: ""
5+
6+
- name: name
7+
type: string
8+
default: ""
9+
10+
- name: os
11+
type: string
12+
default: ""
13+
14+
- name: os_version
15+
type: string
16+
default: ""
17+
18+
- name: build_tag
19+
type: string
20+
default: ""
21+
22+
- name: dockerfile_path
23+
type: string
24+
default: ""
25+
26+
- name: archive_file
27+
type: string
28+
default: '$(name)-$(os)-$(platform)-$(Tag)'
29+
30+
- name: source
31+
type: string
32+
default: drop_setup_env_source
33+
34+
- name: extra_args
35+
type: string
36+
default: ''
37+
38+
39+
- name: default_args
40+
type: object
41+
default:
42+
- "--target $(os) "
43+
- "--platform $(os)/$(arch) "
44+
45+
- name: common_build_args
46+
type: object
47+
default:
48+
- "PLATFORM=$(os)/$(arch) "
49+
- "ARCH=$(arch) "
50+
- "OS=$(os) "
51+
- "VERSION=$(Tag) "
52+
53+
54+
steps:
55+
- task: DownloadPipelineArtifact@2
56+
inputs:
57+
targetPath: $(Build.SourcesDirectory)/dst/${{ parameters.source }}
58+
artifact: '${{ parameters.source }}'
59+
60+
- task: onebranch.pipeline.containercontrol@1
61+
displayName: "Login to ACR"
62+
inputs:
63+
command: login
64+
endpoint: $(ACR_ARM_SERVICE_CONNECTION)
65+
66+
# Build and push the Docker image
67+
- task: onebranch.pipeline.imagebuildinfo@1
68+
displayName: Image Build
69+
retryCountOnTaskFailure: 3
70+
timeoutInMinutes: 30
71+
inputs:
72+
endpoint: $(ACR_ARM_SERVICE_CONNECTION)
73+
registry: $(ACR).azurecr.io
74+
repositoryName: $(os)-$(arch)/${{ parameters.name }}
75+
os: '${{ parameters.os }}'
76+
buildkit: 1
77+
dockerFileRelPath: ${{ parameters.dockerfile_path }}/Dockerfile
78+
dockerFileContextPath: ${{ parameters.source }}
79+
enable_network: true
80+
enable_pull: true
81+
build_tag: ${{ parameters.build_tag }}
82+
enable_acr_push: true
83+
84+
saveImageToPath: images/$(os)-$(arch)/${{ parameters.archive_file }}.tar.gz
85+
#compress: true
86+
#saveMetadataToPath: images/$(os)-$(arch)/metadata/${{ parameters.archive_file }}-metadata.json
87+
#enable_isolated_acr_push: true
88+
89+
# Docker Build Arguments
90+
${{ if parameters.common_build_args }}:
91+
arguments: --build-arg ${{ join('--build-arg ', parameters.common_build_args) }} ${{ parameters.extra_args }} ${{ join(' ', parameters.default_args) }}
92+
${{ else }}:
93+
arguments: ${{ parameters.extra_args }} ${{ join(' ', parameters.default_args) }}
94+
95+
96+
- bash: |
97+
IMAGE_FULL_NAME="$IMAGE_PREFIX/$IMAGE_NAME"
98+
echo >&2 "##vso[task.setvariable variable=IMAGE_PLATFORM_TAG;isOutput=true;]$IMAGE_PLATFORM_TAG"
99+
#echo >&2 "##vso[task.setvariable variable=IMAGE_FULL_NAME;isOutput=true;]$IMAGE_FULL_NAME"
100+
echo >&2 "##vso[task.setvariable variable=IMAGE_REFERENCE;isOutput=true;]$IMAGE_REPO/$IMAGE_FULL_NAME:$IMAGE_PLATFORM_TAG"
101+
#echo >&2 "##vso[task.setvariable variable=IMAGE_ARTIFACT_METADATA_PATH;isOutput=true;]$METADATA_FILE"
102+
#echo >&2 "##vso[task.setvariable variable=IMAGE_ARTIFACT_TAR_PATH;isOutput=true;]$IMAGE_TAR_PATH"
103+
displayName: "Output Image Details"
104+
name: detail
105+
env:
106+
IMAGE_NAME: $(os)-$(arch)/${{ parameters.name }}
107+
IMAGE_PREFIX: 'artifact/dd590928-4e04-48cb-9d3d-ee06c5f0e17f/buddy'
108+
IMAGE_PLATFORM_TAG: '${{ parameters.build_tag }}'
109+
IMAGE_REPO: $(ACN)
110+
METADATA_FILE: images/$(os)-$(arch)/metadata/${{ parameters.archive_file }}-metadata.json
111+
IMAGE_TAR_PATH: images/$(os)-$(arch)/${{ parameters.archive_file }}.tar.gz
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
parameters:
2+
- name: generate
3+
type: jobList
4+
5+
6+
jobs:
7+
- ${{ each job_data in parameters.generate }}:
8+
- job: ${{ job_data.job }}_generate_manifest
9+
displayName: "Generate Image Manifest - ${{ job_data.job }}"
10+
pool:
11+
type: linux
12+
variables:
13+
ob_outputDirectory: $(Build.SourcesDirectory)/out
14+
ob_git_checkout: false
15+
steps:
16+
- template: /.pipelines/build/generate-manifest.steps.yaml
17+
parameters:
18+
platforms: ${{ job_data.templateContext.platforms }}
19+
20+
- job: ${{ job_data.job }}_publish_manifest
21+
displayName: "Publish Image Manifest - ${{ job_data.job }}"
22+
dependsOn:
23+
- ${{ job_data.job }}_generate_manifest
24+
pool:
25+
type: docker
26+
variables:
27+
ob_outputDirectory: $(Build.SourcesDirectory)/out
28+
ob_git_checkout: false
29+
30+
MANIFEST_JSON: $[ dependencies.${{ job_data.job }}_generate_manifest.outputs['data.MANIFEST_JSON'] ]
31+
steps:
32+
- template: /.pipelines/build/publish-manifest.steps.yaml
33+
parameters:
34+
image_repository: ${{ job_data.templateContext.name }}
35+
image_tag: ${{ job_data.templateContext.image_tag }}
36+
manifest_data: $(MANIFEST_JSON)
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
2+
steps:
3+
- template: utils/rename-dockerfile-references.steps.yaml
4+
parameters:
5+
topic: "Linux - ipv6-hp-bpf"
6+
replace_references: true
7+
source_path: bpf-prog/ipv6-hp-bpf
8+
target_path: bpf-prog/ipv6-hp-bpf
9+
source_dockerfile: linux.Dockerfile
10+
11+
- template: utils/rename-dockerfile-references.steps.yaml
12+
parameters:
13+
topic: "Windows - npm"
14+
replace_references: true
15+
working_directory: $(ACN_DIR)
16+
source_path: npm
17+
target_path: npm-windows
18+
source_dockerfile: windows.Dockerfile
19+
20+
- template: utils/rename-dockerfile-references.steps.yaml
21+
parameters:
22+
topic: "Linux - npm"
23+
replace_references: true
24+
working_directory: $(ACN_DIR)
25+
source_path: npm
26+
target_path: npm
27+
source_dockerfile: linux.Dockerfile
28+
29+
- bash: |
30+
rm -rf .pipelines .hooks .github
31+
displayName: "Remove Unnecessary Dirs from Source"
32+
workingDirectory: $(Build.SourcesDirectory)/azure-container-networking
33+
34+
- task: CopyFiles@2
35+
displayName: "Add Repo to Container Artifacts"
36+
inputs:
37+
sourceFolder: $(Build.SourcesDirectory)/azure-container-networking
38+
targetFolder: $(Build.ArtifactStagingDirectory)
39+
40+
- script: |
41+
export CONTAINER_BUILDER=docker
42+
export CONTAINER_RUNTIME=docker
43+
export CONTAINER_TRANSPORT=docker
44+
45+
STORAGE_ID=$(echo "${BUILD_BUILDNUMBER//./-}")
46+
echo "##vso[task.setvariable variable=StorageID;isOutput=true]$STORAGE_ID"
47+
echo "STORAGE_ID: $STORAGE_ID"
48+
49+
COMMITID=$(git rev-parse --short HEAD)
50+
COMMITID="$COMMITID"-"$(date "+%d%H%M")"
51+
echo "##vso[task.setvariable variable=commitID;isOutput=true]$COMMITID"
52+
echo "COMMITID: $COMMITID"
53+
54+
TAG=$(make version)
55+
echo "##vso[task.setvariable variable=Tag;isOutput=true]$TAG"
56+
echo "TAG: $TAG"
57+
58+
AZUREIPAMVERSION=$(make azure-ipam-version)
59+
echo "##vso[task.setvariable variable=azureIpamVersion;isOutput=true]$AZUREIPAMVERSION"
60+
echo "AZUREIPAMVERSION: $AZUREIPAMVERSION"
61+
62+
CNIVERSION=$(make cni-version)
63+
echo "##vso[task.setvariable variable=cniVersion;isOutput=true]$CNIVERSION"
64+
echo "CNIVERSION: $CNIVERSION"
65+
66+
CNSVERSION=$(make cns-version)
67+
echo "##vso[task.setvariable variable=cnsVersion;isOutput=true]$CNSVERSION"
68+
echo "CNSVERSION: $CNSVERSION"
69+
70+
IPV6HPBPFVERSION=$(make ipv6-hp-bpf-version)
71+
echo "##vso[task.setvariable variable=ipv6HpBpfVersion;isOutput=true]$IPV6HPBPFVERSION"
72+
echo "IPV6HPBPFVERSION: $IPV6HPBPFVERSION"
73+
74+
NPMVERSION=$(make npm-version)
75+
echo "##vso[task.setvariable variable=npmVersion;isOutput=true]$NPMVERSION"
76+
echo "NPMVERSION: $NPMVERSION"
77+
78+
cat /etc/os-release
79+
uname -a
80+
sudo chown -R $(whoami):$(whoami) .
81+
go version
82+
go env
83+
which go
84+
echo $PATH
85+
echo "------"
86+
echo $(Build.QueuedBy)
87+
echo $(Build.Reason) # manual, PR, IndividualCI
88+
echo $(Build.SourceBranch)
89+
name: "EnvironmentalVariables"
90+
displayName: "Set environmental variables"
91+
condition: always()
92+
workingDirectory: $(ACN_DIR)

0 commit comments

Comments
 (0)