Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Commit

Permalink
Validate rpm and runner
Browse files Browse the repository at this point in the history
  • Loading branch information
cidrblock authored and ssbarnea committed Jan 16, 2023
1 parent cf45b84 commit 7187a4d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- release

env:
EXTRA_OPTS: --jobs=4 --platform linux/amd64,linux/arm64
EXTRA_OPTS: --jobs=4 --platform=linux/amd64,linux/arm64
EXPECTED_IMAGES: 2

steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:

env:
# We use this option only on release pipeline due to the heavy cost
# EXTRA_OPTS: --platform linux/amd64,linux/arm64
EXPECTED_IMAGES: 1
EXTRA_OPTS: --platform=linux/amd64,linux/arm64
EXPECTED_IMAGES: 2

steps:
- name: Grab the source from Git
Expand Down
3 changes: 1 addition & 2 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,12 @@ tasks:
- ansible-galaxy collection install -r _build/requirements.yml -p collections
- podman manifest exists {{.CNT_NAME_TAG}} && podman manifest rm {{.CNT_NAME_TAG}} || true
- podman image exists {{.CNT_NAME_TAG}} && podman image rm {{.CNT_NAME_TAG}} || true
- podman buildx build ${EXTRA_OPTS:-} --load {{.CNT_ROOT}} --manifest {{.CNT_NAME_TAG}}
- podman buildx build ${EXTRA_OPTS:---platform=linux/amd64,linux/arm64} --load {{.CNT_ROOT}} --manifest {{.CNT_NAME_TAG}}
# running manifest exists is mandatory as this fails if no manifest is
# created locally. If this is skipped the inspect might pull the last
# published manifest instead of using the local one.
- podman manifest exists {{.CNT_NAME_TAG}}
# Fail if the manifest does not contain exactly two images
- podman manifest inspect {{.CNT_NAME_TAG}} | jq '.manifests | length' | grep -q "${EXPECTED_IMAGES:-2}"
# Validate image
- ./_build/validate {{.CNT_NAME_TAG}}
- touch .task/.{{.CNT_NAME}}.done
Expand Down
10 changes: 10 additions & 0 deletions _build/validate
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,15 @@ podman run -i --user="$(id -u)" -e EP_DEBUG=1 "$CNT" uname -a
podman run -i --user="$(id -u)" "$CNT" uname -a
podman run -i --user="$(id -u)" "$CNT" bash -c 'set | grep PATH'
podman run -i --user="$(id -u)" "$CNT" command -v ansible-lint

# ensure that git is configured to consider any directory safe:
podman run -i --user="$(id -u)" "$CNT" bash -c '[[ $(git config safe.directory) == "/" ]]'

# Ensure some packages required are present
# navigator requires the rpm db be intact as it runs rpm -qa
podman run -i --user="$(id -u)" "$CNT" bash -c 'rpm -qa | grep python'
# ansible-runner is needed in all execution environment images
podman run -i --user="$(id -u)" "$CNT" ansible-runner --version

# ensure that the image is build for both supported architectures and the manifest is correct
podman manifest inspect "$CNT" | jq '.manifests | length' | grep -q "${EXPECTED_IMAGES:-2}"

0 comments on commit 7187a4d

Please sign in to comment.