Skip to content

Commit 7cab612

Browse files
committed
feat: deploy gubbins images
1 parent 4cf9b4d commit 7cab612

File tree

3 files changed

+111
-25
lines changed

3 files changed

+111
-25
lines changed

.github/workflows/deployment.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,3 +219,107 @@ jobs:
219219
platforms: linux/amd64,linux/arm64
220220
build-args: |
221221
EXTRA_PACKAGES_TO_INSTALL=git+https://github.com/DIRACGrid/DIRAC.git@integration
222+
223+
# -------------------------------------------------------------------------------------------------
224+
# Gubbins deployment
225+
# -------------------------------------------------------------------------------------------------
226+
227+
build-gubbins-wheels:
228+
name: Build wheels
229+
runs-on: "ubuntu-latest"
230+
needs: deploy-pypi
231+
if: ${{ needs.deploy-pypi.outputs.create-release == 'true' }}
232+
defaults:
233+
run:
234+
# We need extglob for REFERENCE_BRANCH substitution
235+
shell: bash -l -O extglob {0}
236+
steps:
237+
- name: Checkout
238+
uses: actions/checkout@v4
239+
- uses: actions/setup-python@v5
240+
with:
241+
python-version: '3.11'
242+
- name: Installing dependencies
243+
run: |
244+
python -m pip install \
245+
build \
246+
python-dateutil \
247+
pytz \
248+
readme_renderer[md] \
249+
requests \
250+
setuptools_scm
251+
- name: Build distributions
252+
run: |
253+
# build the gubbins package
254+
for pkg_dir in $PWD/extensions/gubbins/gubbins-*; do
255+
# Skip the testing package
256+
if [[ "${pkg_dir}" =~ .*testing.* ]];
257+
then
258+
echo "Do not build ${pkg_dir}";
259+
continue;
260+
fi
261+
echo "Building $pkg_dir"
262+
python -m build --outdir $PWD/dist $pkg_dir
263+
done
264+
- name: 'Upload Artifact'
265+
uses: actions/upload-artifact@v4
266+
with:
267+
name: gubbins-whl
268+
path: dist/*.whl
269+
retention-days: 5
270+
271+
# Build to docker image with the code in it
272+
docker-gubbins:
273+
needs: build-gubbins-wheels
274+
if: ${{ needs.deploy-pypi.outputs.create-release == 'true' }}
275+
timeout-minutes: 30
276+
runs-on: ubuntu-latest
277+
steps:
278+
- name: Checkout
279+
uses: actions/checkout@v4
280+
- name: Set up QEMU
281+
uses: docker/setup-qemu-action@v3
282+
- name: Set up Docker Buildx
283+
uses: docker/setup-buildx-action@v3
284+
- name: Login to GitHub container registry
285+
uses: docker/login-action@v3
286+
with:
287+
registry: ghcr.io
288+
username: ${{ github.actor }}
289+
password: ${{ secrets.GITHUB_TOKEN }}
290+
- name: Download diracx wheels
291+
uses: actions/download-artifact@v4
292+
with:
293+
name: diracx-whl
294+
- name: Download gubbins wheels
295+
uses: actions/download-artifact@v4
296+
with:
297+
name: gubbins-whl
298+
- name: "Find wheels"
299+
id: find_wheel
300+
run: |
301+
# We need to copy them there to be able to access them in the RUN --mount
302+
cp diracx*.whl gubbins*.whl extensions/containers/client/
303+
cp diracx*.whl gubbins*.whl extensions/containers/services/
304+
for wheel_fn in *.whl; do
305+
pkg_name=$(basename "${wheel_fn}" | cut -d '-' -f 1)
306+
echo "${pkg_name}-wheel-name=$(ls "${pkg_name}"-*.whl)" >> $GITHUB_OUTPUT
307+
done
308+
309+
- name: Build and push client (dev)
310+
uses: docker/build-push-action@v6
311+
with:
312+
context: extensions/containers/client
313+
push: ${{ needs.deploy-pypi.outputs.create-release == 'true' }}
314+
tags: ghcr.io/diracgrid/gubbins/client:dev
315+
platforms: linux/amd64,linux/arm64
316+
- name: Build and push service (dev)
317+
uses: docker/build-push-action@v6
318+
with:
319+
context: extensions/containers/services
320+
push: ${{ needs.deploy-pypi.outputs.create-release == 'true' }}
321+
tags: ghcr.io/diracgrid/gubbins/services:dev
322+
platforms: linux/amd64,linux/arm64
323+
build-args: |
324+
EXTRA_PACKAGES_TO_INSTALL=git+https://github.com/DIRACGrid/DIRAC.git@integration
325+
EXTENSION_CUSTOM_SOURCES_TO_INSTALL=/bindmount/gubbins_db*.whl,/bindmount/gubbins_logic*.whl,/bindmount/gubbins_routers*.whl,/bindmount/gubbins_client*.whl

.github/workflows/extensions.yml

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches:
66
- main
7-
- gubbins
87
pull_request:
98
branches:
109
- main
@@ -145,37 +144,22 @@ jobs:
145144
uses: docker/build-push-action@v6
146145
with:
147146
context: extensions/containers/services
148-
tags: gubbins/services:dev
149-
outputs: type=docker,dest=/tmp/gubbins_services_image.tar
147+
tags: ghcr.io/diracgrid/gubbins/services:dev
148+
push: ${{ github.event_name != 'pull_request' && github.repository == 'DIRACGrid/diracx' && github.ref_name == 'main' }}
150149
build-args: |
151150
EXTRA_PACKAGES_TO_INSTALL=git+https://github.com/DIRACGrid/DIRAC.git@integration
152151
EXTENSION_CUSTOM_SOURCES_TO_INSTALL=/bindmount/gubbins_db*.whl,/bindmount/gubbins_logic*.whl,/bindmount/gubbins_routers*.whl,/bindmount/gubbins_client*.whl
153152
- name: Build and export client
154153
uses: docker/build-push-action@v6
155154
with:
156155
context: extensions/containers/client
157-
tags: gubbins/client:dev
158-
outputs: type=docker,dest=/tmp/gubbins_client_image.tar
159-
- name: Upload artifact
160-
uses: actions/upload-artifact@v4
161-
with:
162-
name: gubbins-services-img
163-
path: /tmp/gubbins_services_image.tar
164-
156+
tags: ghcr.io/diracgrid/gubbins/client:dev
157+
push: ${{ github.event_name != 'pull_request' && github.repository == 'DIRACGrid/diracx' && github.ref_name == 'main' }}
165158

166159
pytest-integration:
167160
needs: build-image
168161
runs-on: ubuntu-latest
169162
steps:
170-
- name: Download gubbins-image
171-
uses: actions/download-artifact@v4
172-
with:
173-
name: gubbins-services-img
174-
path: /tmp
175-
- name: Load image
176-
run: |
177-
docker load --input /tmp/gubbins_services_image.tar
178-
docker image ls -a
179163
- name: Checkout code
180164
uses: actions/checkout@v4
181165
- uses: mamba-org/setup-micromamba@v2

extensions/gubbins_values.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
# values specific to testing gubbins
22
global:
3-
# Needed to be able to force pre-load the image in kind
4-
# see https://kind.sigs.k8s.io/docs/user/quick-start/#loading-an-image-into-your-cluster
5-
# and https://iximiuz.com/en/posts/kubernetes-kind-load-docker-image/
6-
imagePullPolicy: IfNotPresent
3+
imagePullPolicy: Always
74
images:
8-
services: gubbins/services
5+
tag: dev
6+
services: ghcr.io/diracgrid/gubbins/services
97

108
developer:
119
enabled: true

0 commit comments

Comments
 (0)