Skip to content

Commit 44682b7

Browse files
committed
Revert "chore(ci)!: update CLI build pipeline (#14360)"
This reverts commit e514bc1. Signed-off-by: katelyn martin <[email protected]>
1 parent 46104e2 commit 44682b7

File tree

6 files changed

+200
-152
lines changed

6 files changed

+200
-152
lines changed

.github/actions/cli-setup/action.yaml

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

.github/workflows/cli-build.yml

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

.github/workflows/integration.yml

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,28 @@ jobs:
6565
build-cli:
6666
needs: meta
6767
if: needs.meta.outputs.changed == 'true'
68-
uses: ./.github/workflows/cli-build.yml
69-
with:
70-
version: ${{ needs.meta.outputs.tag }}
71-
target: linux-amd64
68+
runs-on: ${{ vars.LINKERD2_RUNNER || 'ubuntu-24.04' }}
69+
timeout-minutes: 15
70+
steps:
71+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
72+
- uses: ./.github/actions/docker-build
73+
id: build
74+
with:
75+
docker-registry: ${{ env.DOCKER_REGISTRY }}
76+
docker-target: linux-amd64
77+
component: cli-bin
78+
tag: ${{ needs.meta.outputs.tag }}
79+
- name: Extract CLI binary
80+
run: |
81+
mkdir -p /home/runner/archives
82+
id=$(docker create '${{ steps.build.outputs.image }}')
83+
docker cp "$id:/out/linkerd-linux-amd64" /home/runner/archives/linkerd
84+
v=$(/home/runner/archives/linkerd version --short --client)
85+
[[ "$v" == '${{ needs.meta.outputs.tag }}' ]] || exit 1
86+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
87+
with:
88+
name: image-archives-cli
89+
path: /home/runner/archives
7290

7391
##
7492
## Core: Test the core control plane
@@ -128,12 +146,9 @@ jobs:
128146
pattern: image-archives-*
129147
path: image-archives
130148
merge-multiple: true
149+
- run: cp image-archives/linkerd "$HOME" && chmod 755 "$HOME/linkerd"
131150
- run: find image-archives -ls
132-
- uses: ./.github/actions/cli-setup
133-
with:
134-
artifact-id: ${{ needs.build-cli.outputs.artifact-id }}
135-
target: ${{ runner.temp }}/linkerd
136-
- run: bin/tests --images archive --cleanup-docker --name ${{ matrix.test }} ${{ runner.temp }}/linkerd
151+
- run: bin/tests --images archive --cleanup-docker --name ${{ matrix.test }} "$HOME/linkerd"
137152
env:
138153
LINKERD_DOCKER_REGISTRY: ${{ env.DOCKER_REGISTRY }}
139154
TAG: ${{ needs.meta.outputs.tag }}
@@ -181,10 +196,7 @@ jobs:
181196
path: image-archives
182197
merge-multiple: true
183198
- run: find image-archives -ls
184-
- uses: ./.github/actions/cli-setup
185-
with:
186-
artifact-id: ${{ needs.build-cli.outputs.artifact-id }}
187-
target: ${{ runner.temp }}/linkerd
199+
- run: cp image-archives/linkerd "$HOME" && chmod 755 "$HOME/linkerd"
188200
- name: Setup deps
189201
shell: bash
190202
run: |
@@ -205,7 +217,7 @@ jobs:
205217
- run: docker load <image-archives/controller.tar
206218
- run: docker load <image-archives/proxy.tar
207219
- run: docker image ls
208-
- run: just linkerd-tag='${{ needs.meta.outputs.tag }}' linkerd-exec="${{ runner.temp }}/linkerd" linkerd-install
220+
- run: just linkerd-tag='${{ needs.meta.outputs.tag }}' linkerd-exec="$HOME/linkerd" linkerd-install
209221
- name: Load images
210222
run: |
211223
# Image loading is flakey in CI, so retry!
@@ -283,12 +295,9 @@ jobs:
283295
pattern: image-archives-*
284296
path: image-archives
285297
merge-multiple: true
286-
- run: find image-archives -ls
287-
- uses: ./.github/actions/cli-setup
288-
with:
289-
artifact-id: ${{ needs.build-cli.outputs.artifact-id }}
290-
target: ${{ runner.temp }}/linkerd
291-
- run: bin/tests --images archive --cleanup-docker --name '${{ matrix.integration_test }}' ${{ runner.temp }}/linkerd
298+
- run: cp image-archives/linkerd "$HOME" && chmod 755 "$HOME/linkerd"
299+
- run: ls -l image-archives/linkerd
300+
- run: bin/tests --images archive --cleanup-docker --name '${{ matrix.integration_test }}' "$HOME/linkerd"
292301
env:
293302
LINKERD_DOCKER_REGISTRY: ${{ env.DOCKER_REGISTRY }}
294303

@@ -311,11 +320,9 @@ jobs:
311320
pattern: image-archives-*
312321
path: image-archives
313322
merge-multiple: true
314-
- uses: ./.github/actions/cli-setup
315-
with:
316-
artifact-id: ${{ needs.build-cli.outputs.artifact-id }}
317-
target: ${{ runner.temp }}/linkerd
318-
- run: bin/tests --images archive --cleanup-docker --name viz ${{ runner.temp }}/linkerd
323+
- run: cp image-archives/linkerd "$HOME" && chmod 755 "$HOME/linkerd"
324+
- run: ls -l image-archives/linkerd
325+
- run: bin/tests --images archive --cleanup-docker --name viz "$HOME/linkerd"
319326
env:
320327
LINKERD_DOCKER_REGISTRY: ${{ env.DOCKER_REGISTRY }}
321328

@@ -350,11 +357,8 @@ jobs:
350357
pattern: image-archives-*
351358
path: image-archives
352359
merge-multiple: true
353-
- run: find image-archives -ls
354-
- uses: ./.github/actions/cli-setup
355-
with:
356-
artifact-id: ${{ needs.build-cli.outputs.artifact-id }}
357-
target: ${{ runner.temp }}/linkerd
360+
- run: cp image-archives/linkerd "$HOME" && chmod 755 "$HOME/linkerd"
361+
- run: ls -l image-archives/linkerd
358362
- name: Setup deps
359363
shell: bash
360364
run: |

.github/workflows/release.yml

Lines changed: 47 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
strategy:
4141
matrix:
4242
component:
43+
- cli-bin
4344
- controller
4445
- debug
4546
- jaeger-webhook
@@ -71,12 +72,26 @@ jobs:
7172
- run: cosign sign '${{ steps.build.outputs.digest }}'
7273
env:
7374
COSIGN_YES: true
74-
75-
cli:
76-
needs: tag
77-
uses: ./.github/workflows/cli-build.yml
78-
with:
79-
version: ${{ needs.tag.outputs.tag }}
75+
- name: Create artifact with CLI
76+
# windows_static_cli_tests below needs this because it can't create linux containers
77+
# inside windows
78+
if: matrix.component == 'cli-bin'
79+
env:
80+
ARCHIVES: /home/runner/archives
81+
DOCKER_TARGET: windows
82+
run: |
83+
bin/docker-pull-binaries "$TAG"
84+
mkdir -p "$ARCHIVES"
85+
cp -r "$PWD/target/release/linkerd2-cli-$TAG-windows.exe" "$ARCHIVES/linkerd-windows.exe"
86+
# `with.path` values do not support environment variables yet, so an
87+
# absolute path is used here.
88+
# https://github.com/actions/upload-artifact/issues/8
89+
- name: Upload artifact
90+
if: matrix.component == 'cli-bin'
91+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
92+
with:
93+
name: image-archives-cli
94+
path: /home/runner/archives
8095

8196
windows_static_cli_tests:
8297
name: Static CLI tests (windows)
@@ -99,7 +114,7 @@ jobs:
99114

100115
integration_tests:
101116
name: Integration tests
102-
needs: [tag, cli, docker_build]
117+
needs: [tag, docker_build]
103118
strategy:
104119
matrix:
105120
integration_test:
@@ -121,34 +136,42 @@ jobs:
121136
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5
122137
with:
123138
go-version: "1.24"
124-
- uses: ./.github/actions/cli-setup
125-
with:
126-
artifact-id: ${{ needs.cli.outputs.artifact-id }}
127-
target: ${{ runner.temp }}/linkerd
128-
- run: echo TAG="${{ needs.tag.outputs.tag }}" >> "$GITHUB_ENV"
129-
- name: Validate the CLI version matches the current build tag.
139+
- name: Set environment variables from scripts
130140
run: |
131-
[[ "$TAG" == "$(${{ runner.temp }}/linkerd version --short --client)" ]]
132-
- run: bin/tests --images preload --name ${{ matrix.integration_test }} "${{ runner.temp }}/linkerd"
141+
TAG='${{ needs.tag.outputs.tag }}'
142+
CMD="$PWD/target/release/linkerd2-cli-$TAG-linux-amd64"
143+
echo "CMD=$CMD" >> "$GITHUB_ENV"
144+
echo "TAG=$TAG" >> "$GITHUB_ENV"
145+
- name: Run integration tests
133146
env:
134147
LINKERD_DOCKER_REGISTRY: ${{ env.DOCKER_REGISTRY }}
148+
run: |
149+
bin/docker-pull-binaries "$TAG"
150+
# Validate the CLI version matches the current build tag.
151+
[[ "$TAG" == "$($CMD version --short --client)" ]]
152+
bin/tests --images preload --name ${{ matrix.integration_test }} "$CMD"
135153
136154
gh_release:
137155
name: Create GH release
138156
needs:
139157
- tag
140-
- cli
141158
- integration_tests
142159
timeout-minutes: 30
143160
runs-on: ${{ vars.LINKERD2_RUNNER || 'ubuntu-24.04' }}
144161
permissions:
145162
contents: write
146163
steps:
147164
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
148-
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0
149-
with:
150-
artifact-ids: ${{ needs.cli.outputs.artifact-id }}
151-
path: cli
165+
# - name: Download choco package
166+
# if: startsWith(github.ref, 'refs/tags/stable')
167+
# uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0
168+
# with:
169+
# name: choco
170+
# path: choco
171+
- name: Pull CLI binaries
172+
run: DOCKER_TARGET=multi-arch bin/docker-pull-binaries '${{ needs.tag.outputs.tag }}'
173+
# v=${TAG#"stable-"}
174+
# mv choco/linkerd.*.nupkg "target/release/linkerd2-cli-stable-$v.nupkg" || true
152175
- name: Create release
153176
id: create_release
154177
uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8
@@ -158,7 +181,10 @@ jobs:
158181
draft: false
159182
prerelease: false
160183
files: |
161-
./cli/linkerd2-cli-*
184+
./target/release/linkerd2-cli-*-darwin*
185+
./target/release/linkerd2-cli-*-linux-*
186+
./target/release/linkerd2-cli-*-windows.*
187+
./target/release/linkerd2-cli-*.nupkg
162188
163189
website_publish:
164190
name: Linkerd website publish

bin/docker-pull-binaries

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
5+
if [ $# -eq 1 ]; then
6+
tag=${1:-}
7+
else
8+
echo "usage: ${0##*/} tag" >&2
9+
exit 64
10+
fi
11+
12+
bindir=$( cd "${BASH_SOURCE[0]%/*}" && pwd )
13+
rootdir=$( cd "$bindir"/.. && pwd )
14+
15+
# shellcheck source=_docker.sh
16+
. "$bindir"/_docker.sh
17+
18+
workdir=$rootdir/target/release
19+
mkdir -p "$workdir"
20+
21+
# create shorttag where eventual initial v in tag is stripped
22+
shorttag=${tag#v}
23+
24+
# create the cli-bin container in order to extract the binaries
25+
id=$(docker create "$(docker_repo cli-bin):$tag")
26+
27+
OS=$DOCKER_TARGET
28+
if [ "$DOCKER_TARGET" = 'multi-arch' ]; then
29+
OS=$OS_ARCH_ALL
30+
fi
31+
32+
for os in $OS; do
33+
ext=$os
34+
if [ "$os" = windows ]; then
35+
ext=windows.exe
36+
fi
37+
filepath=$workdir/linkerd2-cli-$shorttag-$ext
38+
docker cp "$id:/out/linkerd-$os" "$filepath"
39+
openssl dgst -sha256 "$filepath" | awk '{print $2}' > "$filepath.sha256"
40+
echo "$filepath"
41+
done
42+
43+
# cleanup the cli-bin container when finished
44+
docker rm "$id" > /dev/null

0 commit comments

Comments
 (0)