-
Notifications
You must be signed in to change notification settings - Fork 55
241 lines (218 loc) · 9.24 KB
/
release.yml
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# Builds and publishes Pulp images
# Ran nightly performing latest, nightly, & supported version releases
# Can be ran manually with specifying Python version for images to be built with
---
name: Release Image
on:
workflow_dispatch:
inputs:
python_version:
description: 'The Python version the images will be built on'
required: false
default: '3.9'
type: string
schedule:
- cron: '0 1 * * *'
push:
branches:
- latest
concurrency:
group: ${{ github.ref_name }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
supported-versions:
if: github.event_name == 'schedule'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# by default, it uses a depth of 1
# this fetches all history so that we can read each commit
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Update to the latest pip
run: python -m pip install --upgrade pip
- name: Dispatch workflows on stable branches
run: |
echo ::group::PYDEPS
pip install gitpython requests packaging jinja2 pyyaml
echo ::endgroup::
python .ci/scripts/update_ci_branches.py
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
base-images:
runs-on: ubuntu-latest
outputs:
base_cache_key: ${{ steps.build_base_images.outputs.base_cache_key }}
image_variants: ${{ steps.image_variants.outputs.image_variants }}
steps:
- name: Set Python Version variable
run: |
python_version=${{ inputs.python_version && inputs.python_version || '3.9' }}
echo "Using Python Version $python_version"
echo "PYTHON_VERSION=${python_version}" >> $GITHUB_ENV
- name: Check valid Python version
if: ${{ ! contains(fromJSON('["3.9", "3.10", "3.11", "3.12"]'), env.PYTHON_VERSION) }}
run: |
echo "Invalid Python Version (${{ env.PYTHON_VERSION }}), must be 3.9-3.12"
exit 1
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install python deps
run: |
echo ::group::PYDEPS
pip install requests packaging
echo ::endgroup::
# We do not want to build nightly images unless it's a PR to the latest branch,
# or a branch/dispatch build on the latest branch.
- name: Set the list of image_variants for later jobs
id: image_variants
run: |
if [ "${{ github.base_ref }}" == "latest" ] || [ "${{ github.ref_name }}" == "latest" ]; then
echo "image_variants=[\"nightly\",\"stable\"]" >> "$GITHUB_OUTPUT"
else
echo "image_variants=[\"stable\"]" >> "$GITHUB_OUTPUT"
fi
- name: Build base images
id: build_base_images
uses: "./.github/actions/base_images"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
python_version: ${{ env.PYTHON_VERSION }}
# The published base images are tagged with the pulpcore version + python version, however
# the base images don't have Pulp installed. Will need to use our context clues of this run
# to figure out which pulpcore version will be installed.
- name: Find pulpcore versions
run: |
pulpcore_version=$(python .ci/scripts/find_pulpcore_version.py --branch "${{ github.ref_name }}")
pulpcore_branch=$(echo ${pulpcore_version} | grep -oP '\d+\.\d+')
echo "Found pulpcore version $pulpcore_version on branch $pulpcore_branch"
echo "PULPCORE_VERSION=${pulpcore_version}" >> $GITHUB_ENV
echo "PULPCORE_BRANCH=${pulpcore_branch}" >> $GITHUB_ENV
if [ "${{ github.ref_name }}" == "latest" ]; then
# We also tag the latest base images with the nightly(main-branch) version of pulpcore
nightly_version=$(python .ci/scripts/find_pulpcore_version.py --branch main)
nightly_branch=$(echo ${nightly_version} | grep -oP '\d+\.\d+')
echo "Found nightly pulpcore version $nightly_version on branch $nightly_branch"
echo "NIGHTLY_VERSION=${nightly_version}" >> $GITHUB_ENV
echo "NIGHTLY_BRANCH=${nightly_branch}" >> $GITHUB_ENV
fi
# Base images on latest will also publish under the next pulpcore version on main.
# If python_version==3.9 (our default python) then publish with just the pulpcore version
# to maintain our prior tagging scheme before customizable python versions
- name: Set image tags
run: |
python_version=${{ env.PYTHON_VERSION }}
python_version="python${python_version//.}"
tags="${PULPCORE_VERSION}-${python_version} ${PULPCORE_BRANCH}-${python_version}"
if [ "${{ github.ref_name }}" == "latest" ]; then
tags="${tags} ${NIGHTLY_VERSION}-${python_version} ${NIGHTLY_BRANCH}-${python_version}"
fi
if [ "${{ env.PYTHON_VERSION }}" == "3.9" ]; then
tags="${tags} ${PULPCORE_VERSION} ${PULPCORE_BRANCH}"
if [ "${{ github.ref_name }}" == "latest" ]; then
tags="${tags} ${NIGHTLY_VERSION} ${NIGHTLY_BRANCH} latest"
fi
fi
tags=$(echo "${tags}" | xargs -n1 | sort -u | xargs)
echo "Set tags to: $tags"
echo "TAGS=${tags}" >> $GITHUB_ENV
- name: Publish base images
uses: "./.github/actions/publish_images"
with:
image_names: "base pulp-ci-centos9"
tags: ${{ env.TAGS }}
github_token: ${{ secrets.GITHUB_TOKEN }}
docker_bot_username: ${{ secrets.DOCKER_BOT_USERNAME }}
docker_bot_password: ${{ secrets.DOCKER_BOT_PASSWORD }}
quay_bot_username: ${{ secrets.QUAY_BOT_USERNAME }}
quay_bot_password: ${{ secrets.QUAY_BOT_PASSWORD }}
app-images:
needs: base-images
runs-on: ubuntu-latest
outputs:
app_version: ${{ steps.build_image.outputs.app_version }}
app_branch: ${{ steps.build_image.outputs.app_branch }}
strategy:
fail-fast: false
matrix:
image_variant: ${{ fromJSON(needs.base-images.outputs.image_variants) }}
image_name:
- pulp-minimal
- pulp
steps:
- uses: actions/checkout@v4
- name: Build App Image
id: build_image
uses: "./.github/actions/build_image"
with:
image_name: ${{ matrix.image_name }}
image_variant: ${{ matrix.image_variant }}
image_cache_key: ${{ needs.base-images.outputs.base_cache_key }}
latest_ui: ${{ github.ref_name == 'latest' }}
- name: Test App Image
if: matrix.image_variant != 'nightly'
uses: "./.github/actions/test_image"
with:
image_name: ${{ matrix.image_name }}
app_branch: ${{ steps.build_image.outputs.app_branch }}
- name: Set tags
run: |
base_image=$(echo ${{ matrix.image_name }} | cut -d '-' -f1)
if [[ "${{ matrix.image_name }}" == "pulp" ]]; then
images="${{ matrix.image_name }}"
else
images="${{ matrix.image_name }} ${base_image}-web"
fi
echo "Going to publish app images: $images"
echo "IMAGES=${images}" >> $GITHUB_ENV
if [ "${{ matrix.image_variant }}" == "stable" ]; then
app_branch=${{ steps.build_image.outputs.app_branch }}
app_version=${{ steps.build_image.outputs.app_version }}
# latest branch stable variant gets tagged as both "latest" and "stable"
if [ "${GITHUB_REF_NAME%/*}" == "latest" ]; then
tags="${app_branch} ${app_version} stable latest"
else
tags="${app_branch} ${app_version}"
fi
else
tags="nightly"
fi
tags=$(echo "${tags}" | xargs -n1 | sort -u | xargs)
echo "Going to publish with tags: $tags"
echo "TAGS=${tags}" >> $GITHUB_ENV
- name: Publish App Image
uses: "./.github/actions/publish_images"
with:
image_names: ${{ env.IMAGES }}
tags: ${{ env.TAGS }}
github_token: ${{ secrets.GITHUB_TOKEN }}
docker_bot_username: ${{ secrets.DOCKER_BOT_USERNAME }}
docker_bot_password: ${{ secrets.DOCKER_BOT_PASSWORD }}
quay_bot_username: ${{ secrets.QUAY_BOT_USERNAME }}
quay_bot_password: ${{ secrets.QUAY_BOT_PASSWORD }}
- name: Logs
if: always()
run: |
set +e
podman ps -a
podman images -a
podman logs pulp
cd images/compose
podman-compose logs
podman logs --tail=10000 compose_pulp_api_1
podman logs --tail=10000 compose_pulp_content_1
podman logs --tail=10000 compose_pulp_worker_1
podman logs --tail=10000 compose_pulp_worker_2
podman logs --tail=10000 compose_pulp_web_1
VOLUME_PATH=$(podman volume inspect pulpdev | jq -r .[].Mountpoint)
sudo ls -al $VOLUME_PATH
sudo tree $VOLUME_PATH
http --follow --timeout 30 --check-status --pretty format --print hb http://localhost:8080/pulp/api/v3/status/ || true