Merge "CI: push images to quay.io"

This commit is contained in:
Zuul 2024-12-10 06:37:48 +00:00 committed by Gerrit Code Review
commit 17b7c60270
5 changed files with 87 additions and 55 deletions

View File

@ -1,65 +1,61 @@
- hosts: all
vars:
ansible_python_interpreter: "/tmp/trove-virtualenv/bin/python"
tasks:
- name: Ensure artifacts/images directory exists
file:
path: '{{ ansible_user_dir }}/images'
state: directory
- name: install requests for community.docker collection
command:
cmd: /tmp/trove-virtualenv/bin/python -m pip install -v requests
- name: Install docker
become: true
package:
name: docker.io
state: present
- name: Start docker
become: true
systemd:
name: docker.io
daemon_reload: true
- name: Run docker registry
- name: Login to quay.io
docker_login:
registry: quay.io
username: "{{ trove_quay_io_creds.username | trim }}"
password: "{{ trove_quay_io_creds.password | trim }}"
# sync images to quay.io to avoid docker rate limitation
- name: retag and push images
become: true
shell: docker run -d --net=host --restart=always -v /opt/trove_registry/:/var/lib/registry --name registry registry:2
- name: Pull and push trove datastore images
become: true
shell: docker pull {{ item }} && docker tag {{item}} 127.0.0.1:5000/trove-datastores/{{ item }} && \
docker push 127.0.0.1:5000/trove-datastores/{{ item }}
community.docker.docker_image:
name: "{{ item.source }}"
repository: "quay.io/openstack.trove/{{ item.dest }}"
tag: "{{ item.tag }}"
push: true
force_tag: true
source: pull
loop:
- "mysql:5.7.29"
- "mysql:8.0"
- "mariadb:10.4"
- "postgres:12"
- name: Build mysql 5.7 backup image
- { source: "ubuntu", dest: "ubuntu", tag: "20.04" }
- { source: "registry", dest: "registry", tag: "2" }
- { source: "mysql", dest: "mysql", tag: "5.7" }
- { source: "mysql", dest: "mysql", tag: "8.0" }
- { source: "mariadb", dest: "mariadb", tag: "10.4" }
- { source: "postgres", dest: "postgres", tag: "12" }
- name: build and push trove backup images
become: true
shell: docker build -t 127.0.0.1:5000/trove-datastores/db-backup-mysql5.7:1.1.0 --build-arg DATASTORE=mysql --build-arg DATASTORE_VERSION=5.7 .
community.docker.docker_image:
build:
path: "{{ ansible_user_dir }}/src/opendev.org/openstack/trove/backup"
args:
chdir: "{{ ansible_user_dir }}/src/opendev.org/openstack/trove/backup"
- name: Build mysql 8.0 backup image
become: true
shell: docker build -t 127.0.0.1:5000/trove-datastores/db-backup-mysql8.0:1.1.0 --build-arg DATASTORE=mysql --build-arg DATASTORE_VERSION=8.0 .
args:
chdir: "{{ ansible_user_dir }}/src/opendev.org/openstack/trove/backup"
- name: Build mariadb backup image
become: true
shell: docker build -t 127.0.0.1:5000/trove-datastores/db-backup-mariadb:1.1.0 --build-arg DATASTORE=mariadb --build-arg DATASTORE_VERSION=10.4 .
args:
chdir: "{{ ansible_user_dir }}/src/opendev.org/openstack/trove/backup"
- name: Build postgresql backup image
become: true
shell: docker build -t 127.0.0.1:5000/trove-datastores/db-backup-postgresql:1.1.2 --build-arg DATASTORE=postgresql --build-arg DATASTORE_VERSION=12 .
args:
chdir: "{{ ansible_user_dir }}/src/opendev.org/openstack/trove/backup"
- name: Push the backup images
become: true
shell: docker push 127.0.0.1:5000/trove-datastores/db-backup-{{item}}
DATASTORE: "{{ item.datastore }}"
DATASTORE_VERSION: "{{ item.version }}"
name: "quay.io/openstack.trove/{{ item.backup_image }}"
tag: "{{ item.version }}"
push: true
source: build
loop:
- "mariadb:1.1.0"
- "postgresql:1.1.2"
- name: Push mysql backup images
become: true
shell: docker push 127.0.0.1:5000/trove-datastores/db-backup-mysql{{ item }}:1.1.0
loop:
- "5.7"
- "8.0"
- name: Compress the docker registry files
become: true
archive:
path: "/opt/trove_registry/"
dest: "{{ ansible_user_dir }}/images/trove-datastore-registry-master.tar.gz"
- { datastore: "mysql", backup_image: "db-backup-mysql", version: "5.7" }
- { datastore: "mysql", backup_image: "db-backup-mysql",version: "8.0" }
- { datastore: "mariadb", backup_image: "db-backup-mariadb", version: "10.4" }
- { datastore: "postgres", backup_image: "db-backup-posrgresql", version: "12" }

View File

@ -0,0 +1,10 @@
- hosts: all
tasks:
- name: Install Python3 pip and setuptools
package:
name:
- python3-pip
- python3-setuptools
become: true
- name: Create virtualenv
command: python3 -m venv /tmp/trove-virtualenv

View File

@ -476,13 +476,13 @@
image_suffix: "-dev"
- job:
name: publish-trove-datastore-images
name: publish-trove-images-quay
description: |
Build and publish trove datastore docker images to
tarballs.openstack.org.
Build and sync trove images to quay.io/openstack.trove.
pre-run: playbooks/image-build/pre.yaml
run: playbooks/image-build/docker-registry.yaml
parent: publish-openstack-artifacts
post-run: playbooks/image-build/post.yaml
nodeset: trove-ubuntu-noble-single
required-projects:
- openstack/trove
secrets:
- trove_quay_io_creds

View File

@ -23,3 +23,29 @@
- name: tempest
nodes:
- controller
- secret:
name: trove_quay_io_creds
data:
username: !encrypted/pkcs1-oaep
- RikBORnOJ0l12Tb4KmXm7HM1P12ig8WsNy8ANfpMBY4AnrsETdw/RfQ35pyTimisu6dkl
L25+6049BOQYT3qHYCtf5nMj7AT9/KtNWTT93fFnj2YvbH8wNJAsCYqCodxa2YKg+rAN3
xF00+7NDKU3wdl7eXC946ypwBmVZTC8U+chEINNlV0iyHQK1Jv9peifl+HfPbMZtB9Xrb
/3tLcAqSZkWkjx/u1tW0FYCUUyTHpPeTkoSV6Xjd/iMp2IINkp8aDszTAl6nFnre+Cqxi
vWjOb9Phfb8j3U6L84Z83BgTAgZX3L+J/lgFLPCVMc2R3WMfHuYs7pYNTxFRCTlPpjQpu
+sg22Fg4QxWaicppdxDSIPQphFALDq7HQxIWcLokpT1U0mY4D64bmeawhCzNYuZ+Hasp2
94vLPkGwrlVZkIeqLh1+y5HViCNmxlPJd64koT2cGLTw7YtQpWUguB3/0j2xMC/qtnQhw
dSx4rDEWYiQTBYtlA8YTC8PXHInUxeHcgAC0NJWI56jpfhfke963XwHRt+wqKEQV83zG2
bSzfp26x6/PUSaUfXG+2DSINe42tBpUfpd4qTEmt60PIdiQEFrm5FMPlQP3we6iHHP4XB
XephdzL+rkkazuetM2osK6XYTfaddF6k6ZlnbX5zPqDyA+mhMndP6uezx4uJws=
password: !encrypted/pkcs1-oaep
- 5BdlzdWHAxMjZOFZx4vNqru66lB31Yr3q04v0iq2APWXBHMegDjDz8aMmAYlWNlf5kxN8
399DV/PKZ8mFS3kCrgKZntMIZV3TrVlGxr5aoFQJc+uUEXtJ+qnahD9PqeCQu1nnniHtW
579YkGNR+1iG/ijbQigu3/ty9rvx+r/B3zpAynJ+nBdvtToFuKV8JlCsLZDtV/FRaskGi
iKMmvjh0BozYR/nDdka8LZFrpvehawkKZ/ToOisiGeSFIgkOfH7av4tp8DCou/0pSPZHb
30VZYTtTRtw4bIxFS1jwm+JsEzBKMuKxi9KKhqlvRm0lTmizLT4ZEwVyyAtwiB4vJZ6Ax
FaWyyjXle6i0TCqjuTM2HSguLwCF8NgDd4yVtdUNC7Eg9vaJ3YbK57v/ul7r83O2Dtb5B
OiFeu8BMp/g2lCkkM3O6OZ+Eie4SDLlvfU0BGwi+y6P2BhCZU4jaHLBsuxs+gdyTGyjKQ
XIIDStaglQJFV7UG5AIsOCgtvSlP6cu/VpHE3/CIu5dKDA/65zZcbqKH+j6y4+aynIgQ5
CfmqR7FHDj9LCgQSWM+36CNhYxWvanQLR4d2L7X9si6K4DxHr2VGb0GqEtkeTkCAYwpXZ
UzKVxd2dqOrnlvy4qMdXBvGOT1fdjjq7QN9Ou4W+L2C793owTiix9lK7Ev1pBs=

View File

@ -48,7 +48,7 @@
branches:
regex: ^stable/.*$
negate: true
- publish-trove-datastore-images:
- publish-trove-images-quay:
branches:
regex: ^stable/.*$
negate: true