Skip to content

Commit 5326a81

Browse files
committed
Move some stances around in the ci scripts
1 parent 17de0a0 commit 5326a81

4 files changed

Lines changed: 35 additions & 39 deletions

File tree

templates/github/.github/workflows/scripts/before_install.sh.j2

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,6 @@ cd "$(dirname "$(realpath -e "$0")")"/../../..
77

88
set -mveuo pipefail
99

10-
if [ "${GITHUB_REF##refs/heads/}" = "${GITHUB_REF}" ]
11-
then
12-
BRANCH_BUILD=0
13-
else
14-
BRANCH_BUILD=1
15-
BRANCH="${GITHUB_REF##refs/heads/}"
16-
fi
17-
if [ "${GITHUB_REF##refs/tags/}" = "${GITHUB_REF}" ]
18-
then
19-
TAG_BUILD=0
20-
else
21-
TAG_BUILD=1
22-
BRANCH="${GITHUB_REF##refs/tags/}"
23-
fi
24-
2510
COMMIT_MSG=$(git log --format=%B --no-merges -1)
2611
export COMMIT_MSG
2712

@@ -44,11 +29,6 @@ if [ -f $PRE_BEFORE_INSTALL ]; then
4429
source $PRE_BEFORE_INSTALL
4530
fi
4631

47-
if [ "$GITHUB_EVENT_NAME" = "pull_request" ] || [ "${BRANCH_BUILD}" = "1" -a "${BRANCH}" != "{{ plugin_default_branch }}" ]
48-
then
49-
echo $COMMIT_MSG | sed -n -e 's/.*CI Base Image:\s*\([-_/[:alnum:]]*:[-_[:alnum:]]*\).*/ci_base: "\1"/p' >> .ci/ansible/vars/main.yaml
50-
fi
51-
5232
for i in {1..3}
5333
do
5434
ansible-galaxy collection install "amazon.aws:8.1.0" && s=0 && break || s=$? && sleep 3

templates/github/.github/workflows/scripts/before_script.sh.j2

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
{% include 'header.j2' %}
44

5+
# This script dumps some files to help understand the setup of the test scenario.
6+
57
# make sure this script runs at the repo root
68
cd "$(dirname "$(realpath -e "$0")")"/../../..
79

@@ -17,33 +19,35 @@ if [[ -f $PRE_BEFORE_SCRIPT ]]; then
1719
fi
1820

1921
# Developers should be able to reproduce the containers with this config
20-
echo "CI vars:"
22+
echo "# CI vars:"
2123
tail -v -n +1 .ci/ansible/vars/main.yaml
2224

2325
# Developers often want to know the final pulp config
24-
echo "PULP CONFIG:"
26+
echo
27+
echo "# Pulp config:"
2528
tail -v -n +1 .ci/ansible/settings/settings.* ~/.config/pulp_smash/settings.json
2629

27-
echo "Containerfile:"
30+
echo
31+
echo "# Containerfile:"
2832
tail -v -n +1 .ci/ansible/Containerfile
2933

30-
echo "Constraints Files:"
31-
# The need not even exist.
34+
echo
35+
echo "# Constraints Files:"
36+
# They need not even exist.
3237
tail -v -n +1 ../*/*constraints.txt || true
3338

34-
# Needed for some functional tests
35-
cmd_prefix bash -c "echo '%wheel ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/nopasswd"
36-
cmd_prefix bash -c "usermod -a -G wheel pulp"
39+
echo
40+
echo "# pip list outside the container"
3741

38-
if [[ "${REDIS_DISABLED:-false}" == true ]]; then
39-
cmd_prefix bash -c "s6-rc -d change redis"
40-
echo "The Redis service was disabled for $TEST"
41-
fi
42+
echo
43+
echo "# pip list inside the container"
44+
cmd_prefix bash -c "pip3 list"
45+
46+
echo
47+
echo "# State of the containers"
48+
docker ps -a
4249

4350
if [[ -f $POST_BEFORE_SCRIPT ]]; then
4451
source $POST_BEFORE_SCRIPT
4552
fi
4653

47-
# Lots of plugins try to use this path, and throw warnings if they cannot access it.
48-
cmd_prefix mkdir /.pytest_cache
49-
cmd_prefix chown pulp:pulp /.pytest_cache

templates/github/.github/workflows/scripts/install.sh.j2

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,18 @@ if [[ "$TEST" = "azure" ]]; then
227227
az storage container create --name pulp-test --connection-string $AZURE_STORAGE_CONNECTION_STRING
228228
fi
229229

230-
echo ::group::PIP_LIST
231-
cmd_prefix bash -c "pip3 list"
232-
echo ::endgroup::
230+
# Needed for some functional tests
231+
cmd_prefix bash -c "echo '%wheel ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/nopasswd"
232+
cmd_prefix bash -c "usermod -a -G wheel pulp"
233+
{%- if disabled_redis_runners %}
234+
235+
# In some scenarios we want to simulate a failed redis cache.
236+
if [[ " {{ " ".join(disabled_redis_runners) }} " =~ " ${TEST} " ]]; then
237+
cmd_prefix bash -c "s6-rc -d change redis"
238+
echo "The Redis service was disabled for $TEST"
239+
fi
240+
{%- endif %}
241+
242+
# Lots of plugins try to use this path, and throw warnings if they cannot access it.
243+
cmd_prefix mkdir /.pytest_cache
244+
cmd_prefix chown pulp:pulp /.pytest_cache

templates/github/.github/workflows/test.yml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575

7676
{{ run_script(name="Install", file="install.sh") | indent(6) }}
7777

78-
{{ run_script(name="Before Script", file="before_script.sh", extra_env={"REDIS_DISABLED": "${{ contains('%s', matrix.env.TEST) }}" % (disabled_redis_runners | default(["TILT"]) | join(' '))}) | indent(6) }}
78+
{{ run_script(name="Before Script", file="before_script.sh") | indent(6) }}
7979

8080
{{ run_script(name="Script", file="script.sh") | indent(6) }}
8181
{%- if test_deprecations %}

0 commit comments

Comments
 (0)