|
1 | 1 | #!/bin/bash -e
|
2 |
| -# cspell: ignore euxo buildx |
| 2 | +# cspell: ignore euxo buildx execdir |
3 | 3 | set -euxo pipefail
|
4 | 4 | ADT_CONTAINER_ENGINE=${ADT_CONTAINER_ENGINE:-docker}
|
5 |
| -CONTAINER_NAME=ansible/ansible-workspace-env-reference:test |
| 5 | +IMAGE_NAME=ansible/ansible-workspace-env-reference:test |
6 | 6 |
|
7 |
| -mkdir -p out |
| 7 | +mkdir -p out dist |
8 | 8 | # Ensure that we packaged the code first
|
9 |
| -WHEELS=(dist/*.whl) |
| 9 | +# shellcheck disable=SC2207 |
| 10 | +WHEELS=($(find dist -name '*.whl' -maxdepth 1 -execdir echo '{}' ';')) |
10 | 11 | if [ ${#WHEELS[@]} -ne 1 ]; then
|
11 | 12 | tox -e pkg
|
12 |
| - WHEELS=(dist/*.whl) |
| 13 | + # shellcheck disable=SC2207 |
| 14 | + WHEELS=($(find dist -name '*.whl' -maxdepth 1 -execdir echo '{}' ';')) |
13 | 15 | if [ ${#WHEELS[@]} -ne 1 ]; then
|
14 |
| - echo "Unable to find a single wheel file in dist/ directory." |
| 16 | + echo "Unable to find a single wheel file in dist/ directory: ${WHEELS[*]}" |
15 | 17 | exit 2
|
16 | 18 | fi
|
17 | 19 | fi
|
18 |
| -tox -e pkg |
19 | 20 | rm -f devspaces/context/*.whl
|
20 | 21 | cp dist/*.whl devspaces/context
|
21 | 22 | cp tools/setup-image.sh devspaces/context
|
22 | 23 |
|
23 | 24 | # we force use of linux/amd64 platform because source image supports only this
|
24 | 25 | # platform and without it, it will fail to cross-build when task runs on arm64.
|
25 | 26 | # --metadata-file=out/devspaces.meta --no-cache
|
26 |
| -$ADT_CONTAINER_ENGINE buildx build --tag=$CONTAINER_NAME --platform=linux/amd64 devspaces/context -f devspaces/Containerfile |
| 27 | +$ADT_CONTAINER_ENGINE buildx build --tag=$IMAGE_NAME --platform=linux/amd64 devspaces/context -f devspaces/Containerfile |
27 | 28 |
|
28 |
| -mk containers check $CONTAINER_NAME --engine="${ADT_CONTAINER_ENGINE}" --max-size=1600 --max-layers=23 |
| 29 | +mk containers check $IMAGE_NAME --engine="${ADT_CONTAINER_ENGINE}" --max-size=1600 --max-layers=23 |
| 30 | + |
| 31 | +pytest --only-container --container-engine="${ADT_CONTAINER_ENGINE}" --container-name=devspaces --image-name=$IMAGE_NAME "$@" || echo "::error::Ignored failed devspaces tests, please https://github.com/ansible/ansible-dev-tools/issues/467" |
29 | 32 |
|
30 | 33 | if [[ -n "${GITHUB_SHA:-}" ]]; then
|
31 |
| - $ADT_CONTAINER_ENGINE tag $CONTAINER_NAME "ghcr.io/ansible/ansible-devspaces-tmp:${GITHUB_SHA}" |
| 34 | + $ADT_CONTAINER_ENGINE tag $IMAGE_NAME "ghcr.io/ansible/ansible-devspaces-tmp:${GITHUB_SHA}" |
32 | 35 | # https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry
|
33 | 36 | if [[ -n "${GITHUB_TOKEN:-}" ]]; then
|
34 | 37 | echo "$GITHUB_TOKEN" | docker login ghcr.io -u "$GITHUB_ACTOR" --password-stdin
|
|
0 commit comments