-
Notifications
You must be signed in to change notification settings - Fork 542
93 lines (74 loc) · 2.84 KB
/
e2e.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Basic e2e test
on:
pull_request:
branches: ['main']
jobs:
e2e:
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
- windows-latest
name: e2e ${{ matrix.platform }}
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: crane append to an image, set the entrypoint, run it locally, roundtrip it
shell: bash
run: |
set -euxo pipefail
# Setup local registry
go run ./cmd/registry &
base=alpine
platform=linux/amd64
if [[ "${{ matrix.platform }}" == "windows-latest" ]]; then
base=mcr.microsoft.com/windows/nanoserver:ltsc2022
platform=windows/amd64
fi
CGO_ENABLED=0 go build -o app/crane ./cmd/crane
tar cvf crane.tar app
# This prevents Bash for Windows from mangling path names.
# It shouldn't be necessary in general unless you're using Bash for
# Windows.
export MSYS_NO_PATHCONV=1
img=$(./app/crane mutate \
--entrypoint=/app/crane,version \
$(./app/crane append \
--platform ${platform} \
--base ${base} \
--new_tag localhost:1338/append-test \
--new_layer crane.tar))
# Run the image with and without args.
docker run $img
docker run $img --help
# Make sure we can roundtrip it through pull/push
layout=$(mktemp -d)
dst=localhost:1338/roundtrip-test
./app/crane pull --format=oci $img $layout
./app/crane push --image-refs=foo.images $layout $dst
diff <(./app/crane manifest $img) <(./app/crane manifest $(cat foo.images))
# Make sure we can roundtrip an index (distroless).
distroless=$(mktemp -d)
remote="gcr.io/distroless/static"
local="localhost:1338/distroless:static"
./app/crane pull --format=oci $remote $distroless
./app/crane push $distroless $local
diff <(./app/crane manifest $remote) <(./app/crane manifest $local)
# And that it works for a single platform (pulling from what we just pushed).
distroless=$(mktemp -d)
remote="$local"
local="localhost:1338/distroless/platform:static"
./app/crane pull --platform=linux/arm64 --format=oci $remote $distroless
./app/crane push $distroless $local
diff <(./app/crane manifest --platform linux/arm64 $remote) <(./app/crane manifest $local)
- name: crane pull image, and export it from stdin to filesystem tar to stdout
shell: bash
run: |
set -euxo pipefail
./app/crane pull ubuntu ubuntu.tar
./app/crane export - - < ubuntu.tar > filesystem.tar
ls -la *.tar