This repository has been archived by the owner on May 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
sync-test-assets.sh
48 lines (33 loc) · 1.57 KB
/
sync-test-assets.sh
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
#!/usr/bin/env bash
# Copyright (c) 2019-2020 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: BSD-2-Clause
### requires to be logged in the target registry
set -eux -o pipefail
DEPLAB_ASSET_REPOSITORY="dependencylabeler/deplab-test-asset"
IMAGE_ARCHIVES="test/integration/assets/image-archives"
### Build and push all dockerfiles to registry
for dockerfile in test/integration/assets/dockerfiles/Dockerfile* ; do
(cd test/integration/assets/dockerfiles
filename=$(basename "$dockerfile")
image_name=$DEPLAB_ASSET_REPOSITORY:${filename/Dockerfile./}
docker build . -f "$filename" -t "${image_name}"
docker push "${image_name}"
)
done
### Save locally image from registry
images=( "cloudfoundry/run:tiny" \
"$DEPLAB_ASSET_REPOSITORY:all-file-types" \
"$DEPLAB_ASSET_REPOSITORY:broken-files" \
"$DEPLAB_ASSET_REPOSITORY:tiny-with-invalid-label" \
"$DEPLAB_ASSET_REPOSITORY:os-release-on-scratch" \
"$DEPLAB_ASSET_REPOSITORY:scratch" \
"$DEPLAB_ASSET_REPOSITORY:scratch-with-buildpack-metadata" \
"$DEPLAB_ASSET_REPOSITORY:char-device")
for image in "${images[@]}"; do
filename="${image##*:}.tgz"
docker save "$image" -o "$IMAGE_ARCHIVES/$filename"
done
### Additional assets
go run cmd/deplab/main.go --image-tar "$IMAGE_ARCHIVES/tiny.tgz" --git . --output-tar "$IMAGE_ARCHIVES/tiny-deplabd.tgz"
crane push "$IMAGE_ARCHIVES/tiny-deplabd.tgz" "$DEPLAB_ASSET_REPOSITORY:tiny-deplabd"
tar czvf "$IMAGE_ARCHIVES/invalid-image-archive.tgz" "$IMAGE_ARCHIVES/../sources/empty-file.yml"