forked from openshift-eng/aos-cd-jobs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorigin.yml
More file actions
215 lines (208 loc) · 8.19 KB
/
origin.yml
File metadata and controls
215 lines (208 loc) · 8.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
---
parameters:
- name: JOB_SPEC
description: "JSON form of job specification."
- name: BUILD_ID
description: "Unique build number for each run."
- name: REPO_OWNER
description: "GitHub org that triggered the job."
default_value: openshift
- name: REPO_NAME
description: "GitHub repo that triggered the job."
default_value: origin
- name: PULL_BASE_REF
description: "Ref name of the base branch."
- name: PULL_BASE_SHA
description: "Git SHA of the base branch."
- name: PULL_REFS
description: "All refs to test."
- name: PULL_NUMBER
description: "Pull request number."
- name: PULL_PULL_SHA
description: "Pull request head SHA."
- name: JOB_SPEC
description: "The job spec definition."
- name: PROW_JOB_ID
description: "The ID that prow sets on a Jenkins job in order to correlate it with a ProwJob."
provision:
os: "rhel"
stage: "base"
provider: "aws"
sync_repos:
- name: "origin"
- name: "image-registry"
- name: "kubernetes-metrics-server"
actions:
- type: "forward_parameters"
parameters:
- REPO_OWNER
- REPO_NAME
- PULL_BASE_REF
- PULL_BASE_SHA
- PULL_REFS
- PULL_NUMBER
- PULL_PULL_SHA
- JOB_NAME
- JOB_SPEC
- BUILD_NUMBER
- type: "script"
title: "record the starting metadata"
timeout: 300
repository: "aos-cd-jobs"
script: |-
trap 'exit 0' EXIT
sjb/gcs/started.py
- type: "host_script"
title: "upload GCS starting metadata"
timeout: 300
script: |-
trap 'exit 0' EXIT
mkdir -p gcs/
scp -F ${WORKSPACE}/.config/origin-ci-tool/inventory/.ssh_config openshiftdevel:/data/started.json gcs/
BUILD="${BUILD_NUMBER}"
function gcs_path() {
bucket="gs://origin-ci-test/"
suffix="${JOB_NAME}/${BUILD}/"
if [[ -n "${REPO_OWNER:-}" ]]; then
if [[ "${REPO_NAME}" != "origin" ]]; then
segment="${REPO_OWNER}_${REPO_NAME}/"
fi
if [[ -n "${PULL_NUMBER:-}" ]]; then
# this is a presubmit
prefix="pr-logs/pull/"
segment="${segment:-}${PULL_NUMBER}/"
else
if [[ "${PULL_REFS}" =~ ^[^:]+:[^:]+(,[^:]+:[^:]+){2,} ]]; then
# this is a batch
prefix="pr-logs/pull/batch/"
else
# this is a postsubmit
prefix="logs/"
fi
fi
else
# this is a periodic
prefix="logs/"
fi
echo "${bucket}${prefix}${segment:-}${suffix}"
return 0
}
if path="$( gcs_path )"; then
gsutil cp gcs/started.json "${path}started.json"
if [[ -n "${PULL_NUMBER:-}" ]]; then
echo "${path%\/}" > "${BUILD}.txt"
gsutil cp "${BUILD}.txt" "gs://origin-ci-test/pr-logs/directory/${JOB_NAME}/${BUILD}.txt"
fi
echo ${BUILD} > latest-build.txt
job_type=$( jq --compact-output ".type" <<<${JOB_SPEC} )
if [[ $job_type =~ "presubmit" || $job_type =~ "batch" ]]; then
gsutil cp latest-build.txt "gs://origin-ci-test/pr-logs/directory/${JOB_NAME}/latest-build.txt"
elif [[ $job_type =~ "postsubmit" || $job_type =~ "periodic" ]]; then
gsutil cp latest-build.txt "gs://origin-ci-test/logs/${JOB_NAME}/latest-build.txt"
else
echo "Bad job type provided in JOB_SPEC: $job_type"
fi
fi
- type: "script"
title: "use a ramdisk for etcd"
timeout: 300
script: |-
sudo su root <<SUDO
mkdir -p /tmp
mount -t tmpfs -o size=4096m tmpfs /tmp
mkdir -p /tmp/etcd
chmod a+rwx /tmp/etcd
restorecon -R /tmp
echo "ETCD_DATA_DIR=/tmp/etcd" >> /etc/environment
SUDO
- type: "script"
title: "turn off unnecessary CentOS PaaS SIG repos"
timeout: 300
script: |-
sudo yum-config-manager --disable centos-paas-sig-openshift-origin\*-rpms
if [[ "${JOB_NAME}" == *update* ]]; then
branch="${PULL_BASE_REF:-"master"}"
case "${branch}" in
master )
sudo yum-config-manager --enable centos-paas-sig-openshift-origin37-rpms
;;
release-* )
major="$( echo "${branch}" | grep -Po "(?<=release-)[0-9](?=\.[0-9])" )"
minor="$( echo "${branch}" | grep -Po "(?<=release-[0-9]\.)[0-9]" )"
previous="$(( minor - 1 ))"
repo="centos-paas-sig-openshift-origin${major}${previous}-rpms"
sudo yum-config-manager --enable "${repo}"
;;
enterprise-* )
major="$( echo "${branch}" | grep -Po "(?<=release-)[0-9](?=\.[0-9])" )"
minor="$( echo "${branch}" | grep -Po "(?<=release-[0-9]\.)[0-9]" )"
previous="$(( minor - 1 ))"
repo="centos-paas-sig-openshift-origin${major}${previous}-rpms"
sudo yum-config-manager --enable "${repo}"
;;
esac
fi
- type: "script"
title: "enable docker tested repo"
timeout: 300
script: |-
if [[ "${PULL_BASE_REF:-master}" == "master" || "${PULL_BASE_REF:-master}" == "release-3.9" || "${PULL_BASE_REF:-master}" == "release-3.10" ]]; then
sudo touch /etc/yum.repos.d/dockertested.repo
sudo chmod a+rw /etc/yum.repos.d/dockertested.repo
cat <<REPO >/etc/yum.repos.d/dockertested.repo
[dockertested]
name=dockertested
baseurl=https://mirror.openshift.com/enterprise/rhel/dockertested/x86_64/os/
enabled=1
sslverify=0
REPO
fi
set +x
echo "username=$MIRROR_OS_USER" >> /etc/yum.repos.d/dockertested.repo
echo "password=$MIRROR_OS_PASS" >> /etc/yum.repos.d/dockertested.repo
post_actions:
- type: "host_script"
title: "assemble GCS output"
timeout: 300
script: |-
trap 'exit 0' EXIT
mkdir -p gcs/artifacts gcs/artifacts/generated gcs/artifacts/journals gcs/artifacts/gathered
result=$( python -c "import json; import urllib; print json.load(urllib.urlopen('${BUILD_URL}api/json'))['result']" )
cat <<FINISHED >gcs/finished.json
{
"timestamp": $( date +%s ),
"result": "${result}"
}
FINISHED
cat "/var/lib/jenkins/jobs/${JOB_NAME}/builds/${BUILD_NUMBER}/log" > gcs/build-log.txt
cp artifacts/generated/* gcs/artifacts/generated/
cp artifacts/journals/* gcs/artifacts/journals/
cp -r artifacts/gathered/* gcs/artifacts/
scp -F ${WORKSPACE}/.config/origin-ci-tool/inventory/.ssh_config -r "$( pwd )/gcs" openshiftdevel:/data
scp -F ${WORKSPACE}/.config/origin-ci-tool/inventory/.ssh_config /var/lib/jenkins/.config/gcloud/gcs-publisher-credentials.json openshiftdevel:/data/credentials.json
- type: "script"
title: "push the artifacts and metadata"
timeout: 300
script: |-
trap 'exit 0' EXIT
if [[ -n "${JOB_SPEC:-}" ]]; then
JOB_SPEC="$( jq --compact-output ".buildid |= \"${BUILD_NUMBER}\"" <<<"${JOB_SPEC}" )"
docker run -e JOB_SPEC="${JOB_SPEC}" -v "/data:/data:z" registry.ci.openshift.org/ci/gcsupload:latest --dry-run=false --gcs-path=gs://origin-ci-test --gcs-credentials-file=/data/credentials.json --path-strategy=single --default-org=openshift --default-repo=origin /data/gcs/*
fi
artifacts:
- "/data/src/github.com/openshift/origin/_output/scripts"
generated_artifacts:
installed_packages.log: 'sudo yum list installed'
avc_denials.log: 'sudo ausearch -m AVC -m SELINUX_ERR -m USER_AVC'
docker.info: 'sudo docker version && sudo docker info && sudo docker images && sudo docker ps -a'
docker.config: 'sudo cat /etc/sysconfig/docker /etc/sysconfig/docker-network /etc/sysconfig/docker-storage /etc/sysconfig/docker-storage-setup /etc/systemd/system/docker.service'
filesystem.info: 'sudo df -T -h && sudo pvs && sudo vgs && sudo lvs && sudo findmnt --all'
pid1.journal: 'sudo journalctl _PID=1 --no-pager --all --lines=all'
dmesg.log: 'sudo journalctl --dmesg --no-pager --all --lines=all'
master-metrics.log: 'oc get --raw /metrics --config=/etc/origin/master/admin.kubeconfig'
node-metrics.log: 'oc get --raw /metrics --server=https://\$( uname --nodename ):10250 --config=/etc/origin/master/admin.kubeconfig'
containers.log: 'sudo find /var/lib/docker/containers -name *.log | sudo xargs tail -vn +1'
system_journals:
- docker.service
- dnsmasq.service
- systemd-journald.service