Skip to content

Commit 899e3e8

Browse files
committed
Add mixed version testing for the deps/rabbit suites
Mix clusters with v3.7 and v3.8, currently on both erlang versions. As this also increases the actions duration rabbit ct-* suites have been de-grouped such that multiple ct suites are no longer run as part of a GitHub Actions job.
1 parent 8e96485 commit 899e3e8

File tree

14 files changed

+10951
-1497
lines changed

14 files changed

+10951
-1497
lines changed

.github/workflows/base-images.yaml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Base Images
1+
name: Workflow Base Images
22
on:
33
- workflow_dispatch
44
jobs:
@@ -8,27 +8,47 @@ jobs:
88
steps:
99
- name: CHECKOUT REPOSITORY
1010
uses: actions/checkout@v2
11-
- name: CREATE BASE CI IMAGE
11+
- name: CREATE ERLANG+ELIXIR IMAGE (22.3)
12+
uses: docker/build-push-action@v1
13+
with:
14+
username: _json_key
15+
password: ${{ secrets.GCR_JSON_KEY }}
16+
registry: eu.gcr.io
17+
repository: cf-rabbitmq-core/erlang_elixir
18+
dockerfile: ci/dockerfiles/22.3/erlang_elixir
19+
tags: "22.3"
20+
- name: CREATE BASE CI IMAGE (22.3)
1221
uses: docker/build-push-action@v1
1322
with:
1423
username: _json_key
1524
password: ${{ secrets.GCR_JSON_KEY }}
1625
registry: eu.gcr.io
1726
repository: cf-rabbitmq-core/ci-base
18-
dockerfile: ci/dockerfiles/22.3/base
27+
dockerfile: ci/dockerfiles/ci-base
28+
build_args: ERLANG_VERSION=22.3,SECONDARY_UMBRELLA_GITREFS=v3.7.28 v3.8.9
1929
tags: "22.3"
2030
ci-base-23_1:
2131
name: ci-base-23_1
2232
runs-on: ubuntu-18.04
2333
steps:
2434
- name: CHECKOUT REPOSITORY
2535
uses: actions/checkout@v2
26-
- name: CREATE BASE CI IMAGE
36+
- name: CREATE ERLANG+ELIXIR IMAGE (23.1)
37+
uses: docker/build-push-action@v1
38+
with:
39+
username: _json_key
40+
password: ${{ secrets.GCR_JSON_KEY }}
41+
registry: eu.gcr.io
42+
repository: cf-rabbitmq-core/erlang_elixir
43+
dockerfile: ci/dockerfiles/23.1/erlang_elixir
44+
tags: "23.1"
45+
- name: CREATE BASE CI IMAGE (23.1)
2746
uses: docker/build-push-action@v1
2847
with:
2948
username: _json_key
3049
password: ${{ secrets.GCR_JSON_KEY }}
3150
registry: eu.gcr.io
3251
repository: cf-rabbitmq-core/ci-base
33-
dockerfile: ci/dockerfiles/23.1/base
52+
dockerfile: ci/dockerfiles/ci-base
53+
build_args: ERLANG_VERSION=23.1,SECONDARY_UMBRELLA_GITREFS=v3.7.28 v3.8.9
3454
tags: "23.1"

.github/workflows/test-erlang-otp-22.3.yaml

Lines changed: 5398 additions & 730 deletions
Large diffs are not rendered by default.

.github/workflows/test-erlang-otp-23.1.yaml

Lines changed: 5398 additions & 730 deletions
Large diffs are not rendered by default.

ci/dockerfiles/22.3/base renamed to ci/dockerfiles/22.3/erlang_elixir

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,3 @@ RUN set -xe \
1616
&& rm elixir-src.tar.gz \
1717
&& cd /usr/local/src/elixir \
1818
&& make install clean
19-
20-
RUN apt-get update && apt-get install -y rsync
21-
22-
RUN curl -L -o buildevents https://github.com/honeycombio/buildevents/releases/latest/download/buildevents-linux-amd64
23-
RUN chmod 755 buildevents
24-
RUN mv buildevents /usr/bin/

ci/dockerfiles/23.1/base renamed to ci/dockerfiles/23.1/erlang_elixir

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,3 @@ RUN set -xe \
1616
&& rm elixir-src.tar.gz \
1717
&& cd /usr/local/src/elixir \
1818
&& make install clean
19-
20-
RUN apt-get update && apt-get install -y rsync
21-
22-
RUN curl -L -o buildevents https://github.com/honeycombio/buildevents/releases/latest/download/buildevents-linux-amd64
23-
RUN chmod 755 buildevents
24-
RUN mv buildevents /usr/bin/

ci/dockerfiles/ci-base

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
ARG ERLANG_VERSION
2+
3+
FROM eu.gcr.io/cf-rabbitmq-core/erlang_elixir:${ERLANG_VERSION}
4+
5+
RUN apt-get update && apt-get install -y rsync zip
6+
7+
RUN curl -L -o buildevents https://github.com/honeycombio/buildevents/releases/latest/download/buildevents-linux-amd64
8+
RUN chmod 755 buildevents
9+
RUN mv buildevents /usr/bin/
10+
11+
WORKDIR /workspace
12+
13+
COPY ci/scripts/fetch_secondary_umbrellas.sh .
14+
15+
# If we clone the monorepo at a ref when the monorepo was still rabbitmq-server,
16+
# then we just get rabbitmq-server (not the monorepo as it would have looked, had
17+
# it existed at that time). So for the time being, secondary umbrellas will derive
18+
# from rabbitmq-public-umbrella (as they always have)
19+
ARG SECONDARY_UMBRELLA_GITREFS
20+
RUN bash fetch_secondary_umbrellas.sh ${SECONDARY_UMBRELLA_GITREFS}

ci/scripts/ct-suite.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,15 @@ catch() {
1414
fi
1515
}
1616

17-
buildevents cmd ${GITHUB_RUN_ID} ${GITHUB_RUN_ID}-${project} ct-${CT_SUITE} -- \
17+
CMD=ct-${CT_SUITE}
18+
SECONDARY_UMBRELLA_ARGS=""
19+
if [[ "${SECONDARY_UMBRELLA_VERSION:-}" != "" ]]; then
20+
CMD=ct-${CT_SUITE}-mixed-${SECONDARY_UMBRELLA_VERSION}
21+
SECONDARY_UMBRELLA_ARGS="SECONDARY_UMBRELLA=/workspace/rabbitmq-${SECONDARY_UMBRELLA_VERSION} RABBITMQ_FEATURE_FLAGS="
22+
fi
23+
24+
buildevents cmd ${GITHUB_RUN_ID} ${GITHUB_RUN_ID}-${project} ${CMD} -- \
1825
make ct-${CT_SUITE} \
1926
FULL= \
2027
FAIL_FAST=1 \
21-
SKIP_AS_ERROR=1
28+
SKIP_AS_ERROR=1 ${SECONDARY_UMBRELLA_ARGS}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
refs="$@"
6+
7+
for version in ${refs}; do
8+
umbrella="umbrellas/$version"
9+
if ! test -d "$umbrella" ||
10+
! make -C "$umbrella/deps/rabbit" test-dist; then
11+
rm -rf "$umbrella"
12+
13+
# Fetch the master Umbrella; the final umbrellas are created from
14+
# the master copy.
15+
if ! test -d umbrellas/master; then
16+
git config --global advice.detachedHead false
17+
git clone \
18+
https://github.com/rabbitmq/rabbitmq-public-umbrella.git \
19+
umbrellas/master
20+
make -C umbrellas/master co # To get RabbitMQ components.
21+
fi
22+
23+
# We copy the master Umbrella and checkout the appropriate tag.
24+
cp -a umbrellas/master "$umbrella"
25+
git -C "$umbrella" checkout "master"
26+
make -C "$umbrella" up BRANCH="$version"
27+
# To remove third-party deps which were checked out when the
28+
# projects were on the `master` branch. Thus, possibly not the
29+
# version pinning we expect. We update the Umbrella one last time
30+
# to fetch the correct third-party deps.
31+
make -C "$umbrella" clean-3rd-party-repos
32+
make -C "$umbrella" up
33+
make -C "$umbrella/deps/rabbit" test-dist
34+
rm -rf "$umbrella"/deps/rabbitmq_website
35+
rm -rf "$umbrella"/deps/rabbitmq_prometheus/docker
36+
rm -rf "$umbrella"/deps/*/{.git,test} "$umbrella"/.git
37+
fi
38+
done
39+
40+
for version in ${refs}; do
41+
umbrella="umbrellas/$version"
42+
mv ${umbrella} rabbitmq-${version}
43+
done
44+
45+
rm -fr umbrellas

mk/github-actions.mk

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,3 @@ docker: local-ci-image
155155
--oom-score-adj -500 \
156156
$(LOCAL_IMAGE) \
157157
/bin/bash
158-
159-
# A literal space.
160-
space :=
161-
space +=
162-
163-
comma := ,
164-
165-
# Joins elements of the list in arg 2 with the given separator.
166-
# 1. Element separator.
167-
# 2. The list.
168-
join-with = $(subst $(space),$1,$(strip $(comma)))

workflow_sources/base_image/workflow.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,41 @@
99
#@ return jobs
1010
#@ end
1111

12+
#@ def to_build_args(d):
13+
#@ return ",".join(['{0}={1}'.format(k,d[k]) for k in d.keys()])
14+
#@ end
15+
1216
#@ def base_image_job(erlang_version):
1317
name: #@ ("ci-base-" + erlang_version).replace(".", "_")
1418
runs-on: ubuntu-18.04
1519
steps:
1620
- name: CHECKOUT REPOSITORY
1721
uses: actions/checkout@v2
18-
- name: CREATE BASE CI IMAGE
22+
- name: #@ 'CREATE ERLANG+ELIXIR IMAGE ({})'.format(erlang_version)
23+
uses: docker/build-push-action@v1
24+
with:
25+
username: _json_key
26+
password: ${{ secrets.GCR_JSON_KEY }}
27+
registry: eu.gcr.io
28+
repository: cf-rabbitmq-core/erlang_elixir
29+
dockerfile: #@ 'ci/dockerfiles/{}/erlang_elixir'.format(erlang_version)
30+
tags: #@ erlang_version
31+
- name: #@ 'CREATE BASE CI IMAGE ({})'.format(erlang_version)
1932
uses: docker/build-push-action@v1
2033
with:
2134
username: _json_key
2235
password: ${{ secrets.GCR_JSON_KEY }}
2336
registry: eu.gcr.io
2437
repository: cf-rabbitmq-core/ci-base
25-
dockerfile: #@ "ci/dockerfiles/" + erlang_version + "/base"
38+
dockerfile: ci/dockerfiles/ci-base
39+
#@ build_args = {}
40+
#@ build_args["ERLANG_VERSION"] = erlang_version
41+
#@ build_args["SECONDARY_UMBRELLA_GITREFS"] = ' '.join(data.values.secondary_umbrella_gitrefs)
42+
build_args: #@ to_build_args(build_args)
2643
tags: #@ erlang_version
2744
#@ end
2845
---
29-
name: Base Images
46+
name: Workflow Base Images
3047
#! https://github.com/k14s/ytt/issues/189
3148
a_magic_string_that_we_will_sed_to_on: [workflow_dispatch]
3249
jobs: #@ jobs_map_from_list([base_image_job(v) for v in data.values.erlang_versions])

workflow_sources/base_values.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#@data/values
22
---
33
base_rmq_ref: master
4+
secondary_umbrella_gitrefs:
5+
- v3.7.28
6+
- v3.8.9
47
#! these values are injected at template time from the cli,
58
#! but must be declared first here
69
erlang_versions: []

workflow_sources/test/ct.lib.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#@ load("@ytt:data", "data")
22
#@ load("@ytt:assert", "assert")
3-
#@ load("util.star", "is_unique", "group_by_time", "to_build_args")
3+
#@ load("util.star", "is_unique", "group_by_one", "to_build_args")
44
#@ load("helpers.star", "ci_image_tag", "ci_dep_image")
55

66
#@ def checks_job(dep):
@@ -77,12 +77,36 @@ steps:
7777
with:
7878
name: (@= dep.name @)-ct-(@= suite @)-logs
7979
path: "ct-(@= suite @)-logs/*-ct-logs-*.tar.xz"
80+
#@ for version in data.values.secondary_umbrella_gitrefs:
81+
#@ logs_dir = 'ct-{}-logs-{}'.format(suite, version)
82+
- name: #@ "RUN ct-{} [mixed {}]".format(suite, version)
83+
run: |
84+
mkdir (@= logs_dir @) && chmod 777 (@= logs_dir @)
85+
docker run \
86+
--env project=(@= dep.name @) \
87+
--env CT_SUITE=(@= suite @) \
88+
--env GITHUB_RUN_ID=${{ github.run_id }} \
89+
--env BUILDEVENT_APIKEY=${{ secrets.HONEYCOMB_API_KEY }} \
90+
--env SECONDARY_UMBRELLA_VERSION=(@= version @) \
91+
--volume ${PWD}/(@= logs_dir @):/workspace/ct-logs \
92+
(@= ci_dep_image(dep.name) @) \
93+
/workspace/rabbitmq/ci/scripts/ct-suite.sh
94+
- name: #@ 'ON FAILURE UPLOAD TESTS LOGS ARTIFACT [mixed {}]'.format(version)
95+
#! https://github.com/marketplace/actions/upload-artifact
96+
uses: actions/upload-artifact@v2-preview
97+
#! For whatever reason, "if: steps.(@= suite @).outcome == 'failure'" never executes,
98+
#! so just run always
99+
if: always()
100+
with:
101+
name: (@= dep.name @)-ct-(@= suite @)-logs-mixed-(@= version @)
102+
path: "(@= logs_dir @)/*-ct-logs-*.tar.xz"
103+
#@ end
80104
#@ end
81105
#@ end
82106

83107
#@ def collect_job(dep):
84108
name: #@ dep.name
85-
needs: #@ [dep.name + "-checks"] + [dep.name + "-ct-" + group["name"] for group in group_by_time(dep.suites)]
109+
needs: #@ [dep.name + "-checks"] + [dep.name + "-ct-" + group["name"] for group in group_by_one(dep.suites)]
86110
runs-on: ubuntu-18.04
87111
if: always()
88112
#@yaml/text-templated-strings

workflow_sources/test/dep.star

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("util.star", "group_by_time")
1+
load("util.star", "group_by_one")
22
load("rabbitmq_cli.lib.yml", "rabbitmq_cli_job")
33
load("ct.lib.yml", "checks_job", "ct_suites_job", "collect_job")
44
load("tests.lib.yml", "tests_job")
@@ -10,7 +10,7 @@ def dep_jobs(dep):
1010
jobs[dep.name] = rabbitmq_cli_job(dep)
1111
elif len(dep.suites) > 20:
1212
jobs[dep.name + "-checks"] = checks_job(dep)
13-
for group in group_by_time(dep.suites):
13+
for group in group_by_one(dep.suites):
1414
jobs[dep.name + "-ct-" + group["name"]] = ct_suites_job(dep, group)
1515
end
1616
jobs[dep.name] = collect_job(dep)

workflow_sources/test/util.star

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ def group_by_time(suites):
4848
return [{"name": name(suites), "suites": [suite.name for suite in suites]} for suites in groups]
4949
end
5050

51+
# Used when we don't actually want multiple ct-suites per job
52+
def group_by_one(suites):
53+
return [{"name": suite.name, "suites": [suite.name]} for suite in suites]
54+
end
55+
5156
def to_build_args(d):
5257
return ",".join(['{0}={1}'.format(k,d[k]) for k in d.keys()])
5358
end

0 commit comments

Comments
 (0)