Skip to content

Commit 9086862

Browse files
committed
Cirrus: Migrate off papr + implement VM testing
Signed-off-by: Chris Evich <cevich@redhat.com>
1 parent 8869618 commit 9086862

File tree

9 files changed

+346
-210
lines changed

9 files changed

+346
-210
lines changed

.cirrus.yml

Lines changed: 114 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,31 @@ env:
55
####
66
#### Global variables used for all tasks
77
####
8+
GOPATH: "/var/tmp/go"
9+
GOSRC: "${GOPATH}/src/github.com/containers/buildah"
810
# Overrides default location (/tmp/cirrus) for repo clone
9-
CIRRUS_WORKING_DIR: "/var/tmp/go/src/github.com/containers/buildah"
11+
CIRRUS_WORKING_DIR: "${GOSRC}"
1012
# Shell used to execute all script commands
1113
CIRRUS_SHELL: "/bin/bash"
1214
# Automation script path relative to $CIRRUS_WORKING_DIR)
1315
SCRIPT_BASE: "./contrib/cirrus"
1416
# No need to go crazy, but grab enough to cover most PRs
1517
CIRRUS_CLONE_DEPTH: 50
18+
# Unless set by in_podman.sh, default to operating outside of a podman container
19+
IN_PODMAN: 'false'
20+
# Not cross-compiling by default
21+
CROSS_TARGET: ""
1622

1723
####
1824
#### Cache-image names to test with
1925
####
2026
# GCE project where images live
2127
IMAGE_PROJECT: "libpod-218412"
28+
# TODO: Setting up from base-images is very inefficient, use libpod's cache-images instead?
2229
FEDORA_CACHE_IMAGE_NAME: "fedora-cloud-base-30-1-2-1565360543"
2330
PRIOR_FEDORA_CACHE_IMAGE_NAME: "fedora-cloud-base-29-1-2-1565360543"
24-
UBUNTU_CACHE_IMAGE_NAME: "ubuntu-1904-disco-v20190724" # Latest
25-
PRIOR_UBUNTU_CACHE_IMAGE_NAME: "ubuntu-1804-bionic-v20190722a" # LTS
31+
UBUNTU_CACHE_IMAGE_NAME: "ubuntu-1904-disco-v20190724"
32+
PRIOR_UBUNTU_CACHE_IMAGE_NAME: "ubuntu-1804-bionic-v20190722a"
2633

2734
####
2835
#### Command variables to help avoid duplication
@@ -50,29 +57,43 @@ gce_instance:
5057
image_name: "${FEDORA_CACHE_IMAGE_NAME}"
5158

5259

53-
testing_task:
54-
gce_instance: # Only need to specify differences from defaults (above)
55-
matrix: # Duplicate this task for each matrix product.
56-
image_name: "${FEDORA_CACHE_IMAGE_NAME}"
57-
image_name: "${PRIOR_FEDORA_CACHE_IMAGE_NAME}"
58-
image_name: "${UBUNTU_CACHE_IMAGE_NAME}"
59-
image_name: "${PRIOR_UBUNTU_CACHE_IMAGE_NAME}"
60+
# Update metadata on VM images referenced by this repository state
61+
meta_task:
6062

61-
# Separate scripts for separate outputs, makes debugging easier.
62-
setup_script: '${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/setup.sh |& ${_TIMESTAMP}'
63-
build_and_test_script: '${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/build_and_test.sh |& ${_TIMESTAMP}'
63+
container:
64+
image: "quay.io/libpod/imgts:latest" # see contrib/imgts
65+
cpu: 1
66+
memory: 1
67+
68+
env:
69+
# Space-separated list of images used by this repository state
70+
IMGNAMES: |-
71+
${FEDORA_CACHE_IMAGE_NAME}
72+
${PRIOR_FEDORA_CACHE_IMAGE_NAME}
73+
${UBUNTU_CACHE_IMAGE_NAME}
74+
${PRIOR_UBUNTU_CACHE_IMAGE_NAME}
75+
BUILDID: "${CIRRUS_BUILD_ID}"
76+
REPOREF: "${CIRRUS_CHANGE_IN_REPO}"
77+
GCPJSON: ENCRYPTED[d3614d6f5cc0e66be89d4252b3365fd84f14eee0259d4eb47e25fc0bc2842c7937f5ee8c882b7e547b4c5ec4b6733b14]
78+
GCPNAME: ENCRYPTED[8509e6a681b859479ce6aa275bd3c4ac82de5beec6df6057925afc4cd85b7ef2e879066ae8baaa2d453b82958e434578]
79+
GCPPROJECT: ENCRYPTED[cc09b62d0ec6746a3df685e663ad25d9d5af95ef5fd843c96f3d0ec9d7f065dc63216b9c685c9f43a776a1d403991494]
80+
CIRRUS_CLONE_DEPTH: 1 # source not used
81+
82+
script: '/usr/local/bin/entrypoint.sh |& ${_TIMESTAMP}'
6483

65-
# Log collection when job was successful
66-
df_script: '${_DFCMD} || true'
67-
rh_audit_log_script: '${_RAUDITCMD} || true'
68-
ubuntu_audit_log_script: '${_UAUDITCMD} || true'
69-
journal_log_script: '${_JOURNALCMD} || true'
7084

71-
on_failure: # Script names must be different from above
72-
failure_df_script: '${_DFCMD} || true'
73-
failure_rh_audit_log_script: '${_RAUDITCMD} || true'
74-
failure_ubuntu_audit_log_script: '${_UAUDITCMD} || true'
75-
failure_journal_log_script: '${_JOURNALCMD} || true'
85+
gate_task:
86+
87+
timeout_in: 20m
88+
89+
setup_script: '${SCRIPT_BASE}/setup.sh |& ${_TIMESTAMP}'
90+
build_script: '${SCRIPT_BASE}/build.sh |& ${_TIMESTAMP}'
91+
validate_test_script: '${SCRIPT_BASE}/test.sh validate |& ${_TIMESTAMP}'
92+
# FIXME: some tests broken
93+
# unit_test_script: '${SCRIPT_BASE}/test.sh unit |& ${_TIMESTAMP}'
94+
95+
binary_artifacts:
96+
path: ./bin/*
7697

7798

7899
# This task runs `make vendor` followed by ./hack/tree_status.sh to check
@@ -81,48 +102,92 @@ testing_task:
81102
# in sync at all times.
82103
vendor_task:
83104

84-
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\*\*\*\s*CIRRUS:\s*TEST\s*IMAGES\s*\*\*\*.*'
85-
86105
env:
87106
CIRRUS_WORKING_DIR: "/var/tmp/go/src/github.com/containers/buildah"
88-
GOPATH: "/go"
89-
GOSRC: "/go/src/github.com/containers/buildah"
107+
GOPATH: "/var/tmp/go"
108+
GOSRC: "/var/tmp/go/src/github.com/containers/buildah"
90109

91110
# Runs within Cirrus's "community cluster"
92111
container:
93112
image: docker.io/library/golang:1.13
94113
cpu: 1
95114
memory: 1
96115

97-
timeout_in: 30m
116+
timeout_in: 5m
98117

99118
vendor_script:
100-
- 'cd ${CIRRUS_WORKING_DIR} && make vendor'
101-
- 'cd ${CIRRUS_WORKING_DIR} && ./hack/tree_status.sh'
119+
- 'make vendor'
120+
- './hack/tree_status.sh'
102121

103-
# Update metadata on VM images referenced by this repository state
104-
meta_task:
122+
123+
cross_task:
105124

106125
depends_on:
107-
- "vendor"
126+
- gate
127+
- vendor
108128

109129
container:
110-
image: "quay.io/libpod/imgts:latest" # see contrib/imgts
111-
cpu: 1
112-
memory: 1
130+
image: registry.fedoraproject.org/fedora:30
113131

114132
env:
115-
# Space-separated list of images used by this repository state
116-
IMGNAMES: |-
117-
${FEDORA_CACHE_IMAGE_NAME}
118-
${PRIOR_FEDORA_CACHE_IMAGE_NAME}
119-
${UBUNTU_CACHE_IMAGE_NAME}
120-
${PRIOR_UBUNTU_CACHE_IMAGE_NAME}
121-
BUILDID: "${CIRRUS_BUILD_ID}"
122-
REPOREF: "${CIRRUS_CHANGE_IN_REPO}"
123-
GCPJSON: ENCRYPTED[d3614d6f5cc0e66be89d4252b3365fd84f14eee0259d4eb47e25fc0bc2842c7937f5ee8c882b7e547b4c5ec4b6733b14]
124-
GCPNAME: ENCRYPTED[8509e6a681b859479ce6aa275bd3c4ac82de5beec6df6057925afc4cd85b7ef2e879066ae8baaa2d453b82958e434578]
125-
GCPPROJECT: ENCRYPTED[cc09b62d0ec6746a3df685e663ad25d9d5af95ef5fd843c96f3d0ec9d7f065dc63216b9c685c9f43a776a1d403991494]
126-
CIRRUS_CLONE_DEPTH: 1 # source not used
133+
matrix:
134+
CROSS_TARGET: darwin
127135

128-
script: '/usr/local/bin/entrypoint.sh |& ${_TIMESTAMP}'
136+
setup_script: '${SCRIPT_BASE}/setup.sh |& ${_TIMESTAMP}'
137+
build_script: '${SCRIPT_BASE}/build.sh |& ${_TIMESTAMP}'
138+
139+
binary_artifacts:
140+
path: ./bin/*
141+
142+
143+
testing_task:
144+
145+
depends_on:
146+
- gate
147+
- vendor
148+
149+
gce_instance: # Only need to specify differences from defaults (above)
150+
matrix: # Duplicate this task for each matrix product.
151+
image_name: "${FEDORA_CACHE_IMAGE_NAME}"
152+
image_name: "${PRIOR_FEDORA_CACHE_IMAGE_NAME}"
153+
image_name: "${UBUNTU_CACHE_IMAGE_NAME}"
154+
image_name: "${PRIOR_UBUNTU_CACHE_IMAGE_NAME}"
155+
156+
# Separate scripts for separate outputs, makes debugging easier.
157+
setup_script: '${SCRIPT_BASE}/setup.sh |& ${_TIMESTAMP}'
158+
build_script: '${SCRIPT_BASE}/build.sh |& ${_TIMESTAMP}'
159+
integration_test_script: '${SCRIPT_BASE}/test.sh integration |& ${_TIMESTAMP}'
160+
161+
binary_artifacts:
162+
path: ./bin/*
163+
164+
always: &standardlogs
165+
df_script: '${_DFCMD} || true'
166+
rh_audit_log_script: '${_RAUDITCMD} || true'
167+
ubuntu_audit_log_script: '${_UAUDITCMD} || true'
168+
journal_log_script: '${_JOURNALCMD} || true'
169+
170+
171+
testing_in_podman_task:
172+
173+
depends_on:
174+
- gate
175+
- vendor
176+
177+
env:
178+
# This is key, it causes the scripts to re-execute themselves inside a container.
179+
IN_PODMAN: 'true'
180+
BUILDAH_ISOLATION: 'chroot'
181+
STORAGE_DRIVER: 'vfs'
182+
STORAGE_OPTIONS: ''
183+
184+
# Separate scripts for separate outputs, makes debugging easier.
185+
setup_script: '${SCRIPT_BASE}/setup.sh |& ${_TIMESTAMP}'
186+
build_script: '${SCRIPT_BASE}/build.sh |& ${_TIMESTAMP}'
187+
integration_test_script: '${SCRIPT_BASE}/test.sh integration |& ${_TIMESTAMP}'
188+
189+
binary_artifacts:
190+
path: ./bin/*
191+
192+
always:
193+
<<: *standardlogs

.papr.sh

Lines changed: 0 additions & 42 deletions
This file was deleted.

.papr.yml

Lines changed: 0 additions & 87 deletions
This file was deleted.

contrib/cirrus/build.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
source $(dirname $0)/lib.sh
6+
7+
req_env_var IN_PODMAN IN_PODMAN_NAME GOSRC
8+
9+
if [[ "$IN_PODMAN" == "true" ]]
10+
then
11+
cd $GOSRC
12+
in_podman --rm $IN_PODMAN_NAME $0
13+
else
14+
cd $GOSRC
15+
echo "Compiling buildah"
16+
showrun make $CROSS_TARGET ${CROSS_TARGET:+CGO_ENABLED=0}
17+
mkdir -p bin
18+
19+
echo "Installing buildah"
20+
if [[ -z "$CROSS_TARGET" ]]
21+
then
22+
ln -v buildah bin/buildah
23+
showrun make install PREFIX=/usr
24+
else
25+
ln -v buildah.${CROSS_TARGET} bin/buildah
26+
fi
27+
fi

contrib/cirrus/build_and_test.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)