Skip to content

Commit 79e7db3

Browse files
committed
fixup! Use Signed Binaries for Docker Build
1 parent 08c2a9c commit 79e7db3

File tree

6 files changed

+51
-26
lines changed

6 files changed

+51
-26
lines changed

.pipelines/build/images.jobs.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,21 @@ jobs:
7070
search_root: $(OUT_DIR)
7171

7272

73+
- task: ShellScript@2
74+
displayName: "Package with DropGZ"
75+
condition: and(succeeded(), eq('$(packageWithDropGZ)', 'True'))
76+
inputs:
77+
scriptPath: $(REPO_ROOT)/.pipelines/build/scripts/dropgz.sh
78+
79+
- task: onebranch.pipeline.signing@1
80+
condition: and(succeeded(), eq('$(packageWithDropGZ)', 'True'))
81+
inputs:
82+
command: 'sign'
83+
signing_profile: 'external_distribution'
84+
files_to_sign: '**/dropgz'
85+
search_root: $(OUT_DIR)
86+
87+
7388
- job: images_${{ job_data.job }}
7489
displayName: "Build Images - ${{ job_data.displayName }} -"
7590
dependsOn:

.pipelines/build/scripts/azure-ipam.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ pushd "$REPO_ROOT"/azure-ipam
1313
-o "$OUT_DIR"/bin/azure-ipam \
1414
-ldflags "-X github.com/Azure/azure-container-networking/azure-ipam/internal/buildinfo.Version="$AZURE_IPAM_VERSION" -X main.version="$AZURE_IPAM_VERSION"" \
1515
-gcflags="-dwarflocationlists=true" \
16-
main.go
16+
.
1717

1818
cp *.conflist "$OUT_DIR"/files/
1919
popd
20-
21-
22-
# Build with DropGZ
23-
./dropgz.sh

.pipelines/build/scripts/cni.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,3 @@ pushd "$REPO_ROOT"/cni
6363
cp azure-$OS-multitenancy.conflist "$OUT_DIR"/files/multitenancy.conflist
6464
cp "$REPO_ROOT"/telemetry/azure-vnet-telemetry.config "$OUT_DIR"/files/azure-vnet-telemetry.config
6565
popd
66-
67-
# Build with DropGZ
68-
./dropgz.sh

.pipelines/build/scripts/dropgz.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#!/bin/bash
2+
set -eux
3+
14
export GOOS=$OS
25
export GOARCH=$ARCH
36
export CGO_ENABLED=0

.pipelines/build/scripts/ipv6-hp-bpf.sh

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,31 @@ mkdir -p "$OUT_DIR"/lib
1212
# Package up Needed C Files
1313
if [[ -f /etc/debian_version ]];then
1414
apt-get update -y
15-
if [[ $GOARCH =~ amd64 ]]; then
16-
apt-get install -y llvm clang linux-libc-dev linux-headers-generic libbpf-dev libc6-dev nftables iproute2 gcc-multilib tree
17-
cp /lib/"$ARCH"/ld-linux-x86-64.so.2 "$OUT_DIR"/lib/
18-
for dir in /usr/include/x86_64-linux-gnu/*; do
19-
ln -sfn "$dir" /usr/include/$(basename "$dir")
20-
done
15+
if [[ $ARCH =~ amd64 ]]; then
16+
apt-get install -y llvm clang linux-libc-dev linux-headers-generic libbpf-dev libc6-dev nftables iproute2 gcc-multilib build-essential binutils
17+
18+
ARCH=x86_64-linux-gnu
19+
cp /usr/lib/"$ARCH"/ld-linux-x86-64.so.2 "$OUT_DIR"/lib/
2120

22-
elif [[ $GOARCH =~ arm64 ]]; then
23-
apt-get install -y llvm clang linux-libc-dev linux-headers-generic libbpf-dev libc6-dev nftables iproute2 gcc-aarch64-linux-gnu tree
24-
cp /lib/"$ARCH"/ld-linux-aarch64.so.1 "$OUT_DIR"/lib/
25-
for dir in /usr/include/aarch64-linux-gnu/*; do
26-
ln -sfn "$dir" /usr/include/$(basename "$dir")
27-
done
21+
elif [[ $ARCH =~ arm64 ]]; then
22+
apt-get install -y llvm clang linux-libc-dev linux-headers-generic libbpf-dev libc6-dev nftables iproute2 gcc-aarch64-linux-gnu
23+
24+
ARCH=aarch64-linux-gnu
25+
PLAT=linux-aarch64
26+
cp /usr/lib/"$ARCH"/ld-linux-aarch64.so.1 "$OUT_DIR"/lib/
2827
fi
28+
29+
for dir in /usr/include/"$ARCH"/*; do
30+
ln -sfn "$dir" /usr/include/$(basename "$dir")
31+
done
32+
33+
2934
# Mariner
3035
else
31-
tdnf install -y llvm clang libbpf-devel nftables tree
32-
cp /lib/"$ARCH"/ld-linux-x86-64.so.2 "$OUT_DIR"/lib/
33-
for dir in /usr/include/x86_64-linux-gnu/*; do
36+
tdnf install -y llvm clang libbpf-devel nftables gcc binutils iproute glibc-devel.i686
37+
ARCH=x86_64-linux-gnu
38+
cp /usr/lib/"$ARCH"/ld-linux-x86-64.so.2 "$OUT_DIR"/lib/
39+
for dir in /usr/include/"$ARCH"/*; do
3440
if [[ -d $dir ]]; then
3541
ln -sfn "$dir" /usr/include/$(basename "$dir")
3642
elif [[ -f "$dir" ]]; then
@@ -39,6 +45,8 @@ else
3945
done
4046
fi
4147

48+
49+
# Copy Library Files
4250
ln -sfn /usr/include/"$ARCH"/asm /usr/include/asm
4351
cp /lib/"$ARCH"/libnftables.so.1 "$OUT_DIR"/lib/
4452
cp /lib/"$ARCH"/libedit.so.2 "$OUT_DIR"/lib/
@@ -61,13 +69,13 @@ cp /sbin/ip "$OUT_DIR"/bin/ip
6169
pushd "$REPO_ROOT"/bpf-prog/ipv6-hp-bpf
6270
cp ./cmd/ipv6-hp-bpf/*.go .
6371

64-
if [ "$DEBUG" = "true" ]; then
72+
if [[ "$DEBUG" =~ ^[T|t]rue$ ]]; then
6573
echo "\n#define DEBUG" >> ./include/helper.h
6674
fi
6775

6876
go generate ./...
6977
go build -v -a -trimpath \
7078
-o "$OUT_DIR"/bin/ipv6-hp-bpf \
71-
-ldflags "-X main.version="$IPV6_HP_BPF_VERSION"" \
72-
-gcflags="-dwarflocationlists=true" .
79+
-ldflags "-X main.version="$IPV6_HP_BPF_VERSION"" \
80+
-gcflags="-dwarflocationlists=true" .
7381
popd

.pipelines/run-pipeline.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,14 @@ stages:
137137
archiveName: azure-ipam
138138
archiveVersion: $(AZURE_IPAM_VERSION)
139139
imageTag: $(Build.BuildNumber)
140+
packageWithDropGZ: True
140141
cni:
141142
name: cni
142143
extraArgs: '--build-arg CNI_AI_PATH=$(CNI_AI_PATH) --build-arg CNI_AI_ID=$(CNI_AI_ID)'
143144
archiveName: azure-cni
144145
archiveVersion: $(CNI_VERSION)
145146
imageTag: $(Build.BuildNumber)
147+
packageWithDropGZ: True
146148
cns:
147149
name: cns
148150
extraArgs: '--build-arg CNS_AI_PATH=$(CNS_AI_PATH) --build-arg CNS_AI_ID=$(CNS_AI_ID)'
@@ -178,12 +180,14 @@ stages:
178180
archiveName: azure-ipam
179181
archiveVersion: $(OS)-$(ARCH)-$(AZURE_IPAM_VERSION)
180182
imageTag: $(Build.BuildNumber)
183+
packageWithDropGZ: True
181184
cni:
182185
name: cni
183186
extraArgs: '--build-arg CNI_AI_PATH=$(CNI_AI_PATH) --build-arg CNI_AI_ID=$(CNI_AI_ID)'
184187
archiveName: azure-cni
185188
archiveVersion: $(CNI_VERSION)
186189
imageTag: $(Build.BuildNumber)
190+
packageWithDropGZ: True
187191
cns:
188192
name: cns
189193
extraArgs: '--build-arg CNS_AI_PATH=$(CNS_AI_PATH) --build-arg CNS_AI_ID=$(CNS_AI_ID)'
@@ -213,12 +217,14 @@ stages:
213217
archiveVersion: $(AZURE_IPAM_VERSION)
214218
extraArgs: ''
215219
imageTag: $(Build.BuildNumber)
220+
packageWithDropGZ: True
216221
cni:
217222
name: cni
218223
extraArgs: '--build-arg CNI_AI_PATH=$(CNI_AI_PATH) --build-arg CNI_AI_ID=$(CNI_AI_ID)'
219224
archiveName: azure-cni
220225
archiveVersion: $(CNI_VERSION)
221226
imageTag: $(Build.BuildNumber)
227+
packageWithDropGZ: True
222228
cns:
223229
name: cns
224230
extraArgs: '--build-arg CNS_AI_PATH=$(CNS_AI_PATH) --build-arg CNS_AI_ID=$(CNS_AI_ID)'

0 commit comments

Comments
 (0)