Skip to content

Commit

Permalink
Update CI
Browse files Browse the repository at this point in the history
* Added python 3.10 to the test matrix.
* Made run_container.sh reusable for different pulp-tooling projects.
  - Added a header reminding to keep that file in sync.
  - Added a .ci/container_setup.d run-parts directory to allow project
    specific setup scripts to run after container startup.

[noissue]
  • Loading branch information
mdellweg committed Nov 2, 2021
1 parent ef66e88 commit c13b44c
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 19 deletions.
15 changes: 15 additions & 0 deletions .ci/container_setup.d/10-install-signing-service.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

set -eu

if pulp --base-url "http://localhost:8080" --username "admin" --password "password" debug has-plugin --name "core" --min-version 3.11
then
echo "Setup a signing service"
"${CONTAINER_RUNTIME}" exec -i "pulp-ephemeral" bash -c "cat > /root/sign_deb_release.sh" < "${BASEPATH}/../tests/assets/sign_deb_release.sh"
"${CONTAINER_RUNTIME}" exec -i "pulp-ephemeral" bash -c "cat > /tmp/setup_signing_service.py" < "${BASEPATH}/../tests/assets/setup_signing_service.py"
curl -L https://github.com/pulp/pulp-fixtures/raw/master/common/GPG-KEY-pulp-qe | "${CONTAINER_RUNTIME}" exec -i "pulp-ephemeral" bash -c "cat > /tmp/GPG-KEY-pulp-qe"
curl -L https://github.com/pulp/pulp-fixtures/raw/master/common/GPG-PRIVATE-KEY-pulp-qe | "${CONTAINER_RUNTIME}" exec -i "pulp-ephemeral" gpg --import
echo "6EDF301256480B9B801EBA3D05A5E6DA269D9D98:6:" | "${CONTAINER_RUNTIME}" exec -i "pulp-ephemeral" gpg --import-ownertrust
"${CONTAINER_RUNTIME}" exec "pulp-ephemeral" chmod a+x /root/sign_deb_release.sh /tmp/setup_signing_service.py
"${CONTAINER_RUNTIME}" exec "pulp-ephemeral" /tmp/setup_signing_service.py /root/sign_deb_release.sh /tmp/GPG-KEY-pulp-qe
fi
32 changes: 21 additions & 11 deletions .ci/run_container.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
#!/bin/sh

# This file is shared between some projects please keep all copies in sync
# Known places:
# - https://github.com/pulp/pulp-cli/blob/main/.ci/run_container.sh
# - https://github.com/pulp/pulp-cli-deb/blob/develop/.ci/run_container.sh
# - https://github.com/pulp/pulp-cli-ostree/blob/main/.ci/run_container.sh
# - https://github.com/pulp/squeezer/blob/develop/tests/run_container.sh

set -eu

BASEPATH="$(dirname "$(readlink -f "$0")")"
export BASEPATH

if [ -z "${CONTAINER_RUNTIME:+x}" ]
then
Expand All @@ -13,6 +21,7 @@ then
CONTAINER_RUNTIME=docker
fi
fi
export CONTAINER_RUNTIME

if [ -z "${KEEP_CONTAINER:+x}" ]
then
Expand All @@ -21,15 +30,23 @@ else
RM=""
fi

"${CONTAINER_RUNTIME}" run ${RM:+--rm} --detach --name "pulp-ephemeral" --volume "${BASEPATH}/settings:/etc/pulp" --publish "8080:80" "pulp/pulp:${IMAGE_TAG:-latest}"
IMAGE_TAG="${IMAGE_TAG:-latest}"
FROM_TAG="${FROM_TAG:-latest}"

if [ "${CONTAINER_FILE:+x}" ]
then
"${CONTAINER_RUNTIME}" build --file "${BASEPATH}/assets/${CONTAINER_FILE}" --build-arg FROM_TAG="${FROM_TAG}" --tag pulp/pulp:"${IMAGE_TAG}" .
fi

"${CONTAINER_RUNTIME}" run ${RM:+--rm} --detach --name "pulp-ephemeral" --volume "${BASEPATH}/settings:/etc/pulp" --publish "8080:80" "pulp/pulp:${IMAGE_TAG}"

# shellcheck disable=SC2064
trap "${CONTAINER_RUNTIME} stop pulp-ephemeral" EXIT
# shellcheck disable=SC2064
trap "${CONTAINER_RUNTIME} stop pulp-ephemeral" INT

echo "Wait for pulp to start."
for counter in $(seq 20)
for counter in $(seq 20 -1 0)
do
sleep 3
if curl --fail http://localhost:8080/pulp/api/v3/status/ > /dev/null 2>&1
Expand All @@ -54,16 +71,9 @@ curl -s http://localhost:8080/pulp/api/v3/status/ | jq '.versions|map({key: .com
# Set admin password
"${CONTAINER_RUNTIME}" exec "pulp-ephemeral" pulpcore-manager reset-admin-password --password password

if pulp --base-url "http://localhost:8080" --username "admin" --password "password" debug has-plugin --name "core" --min-version 3.11
if [ -d "${BASEPATH}/container_setup.d/" ]
then
# Setup a signing service
"${CONTAINER_RUNTIME}" exec -i "pulp-ephemeral" bash -c "cat > /root/sign_deb_release.sh" < "${BASEPATH}/../tests/assets/sign_deb_release.sh"
"${CONTAINER_RUNTIME}" exec -i "pulp-ephemeral" bash -c "cat > /tmp/setup_signing_service.py" < "${BASEPATH}/../tests/assets/setup_signing_service.py"
curl -L https://github.com/pulp/pulp-fixtures/raw/master/common/GPG-KEY-pulp-qe | "${CONTAINER_RUNTIME}" exec -i "pulp-ephemeral" bash -c "cat > /tmp/GPG-KEY-pulp-qe"
curl -L https://github.com/pulp/pulp-fixtures/raw/master/common/GPG-PRIVATE-KEY-pulp-qe | "${CONTAINER_RUNTIME}" exec -i "pulp-ephemeral" gpg --import
echo "6EDF301256480B9B801EBA3D05A5E6DA269D9D98:6:" | "${CONTAINER_RUNTIME}" exec -i "pulp-ephemeral" gpg --import-ownertrust
"${CONTAINER_RUNTIME}" exec "pulp-ephemeral" chmod a+x /root/sign_deb_release.sh /tmp/setup_signing_service.py
"${CONTAINER_RUNTIME}" exec "pulp-ephemeral" /tmp/setup_signing_service.py /root/sign_deb_release.sh /tmp/GPG-KEY-pulp-qe
run-parts --regex '^[0-9]+-[-_[:alnum:]]*\.sh$' "${BASEPATH}/container_setup.d/"
fi

PULP_LOGGING="${CONTAINER_RUNTIME}" "$@"
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ jobs:
image_tag: "nightly"
- python: "3.6"
image_tag: "3.16"
- python: "3.6"
- python: "3.7"
image_tag: "3.15"
- python: "3.9"
- python: "3.8"
image_tag: "3.14"
- python: "3.7"
- python: "3.9"
image_tag: "3.13"
- python: "3.8"
- python: "3.10"
image_tag: "3.12"
steps:
- uses: actions/checkout@v2
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ jobs:
image_tag: "nightly"
- python: "3.6"
image_tag: "3.16"
- python: "3.6"
- python: "3.7"
image_tag: "3.15"
- python: "3.9"
- python: "3.8"
image_tag: "3.14"
- python: "3.7"
- python: "3.9"
image_tag: "3.13"
- python: "3.8"
- python: "3.10"
image_tag: "3.12"
steps:
- uses: actions/checkout@v2
Expand Down

0 comments on commit c13b44c

Please sign in to comment.