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 - hosts: all
vars:
ansible_python_interpreter: "/tmp/trove-virtualenv/bin/python"
tasks: tasks:
- name: Ensure artifacts/images directory exists - name: install requests for community.docker collection
file: command:
path: '{{ ansible_user_dir }}/images' cmd: /tmp/trove-virtualenv/bin/python -m pip install -v requests
state: directory
- name: Install docker - name: Install docker
become: true become: true
package: package:
name: docker.io name: docker.io
state: present state: present
- name: Start docker - name: Start docker
become: true become: true
systemd: systemd:
name: docker.io name: docker.io
daemon_reload: true 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 become: true
shell: docker run -d --net=host --restart=always -v /opt/trove_registry/:/var/lib/registry --name registry registry:2 community.docker.docker_image:
- name: Pull and push trove datastore images name: "{{ item.source }}"
become: true repository: "quay.io/openstack.trove/{{ item.dest }}"
shell: docker pull {{ item }} && docker tag {{item}} 127.0.0.1:5000/trove-datastores/{{ item }} && \ tag: "{{ item.tag }}"
docker push 127.0.0.1:5000/trove-datastores/{{ item }} push: true
force_tag: true
source: pull
loop: loop:
- "mysql:5.7.29" - { source: "ubuntu", dest: "ubuntu", tag: "20.04" }
- "mysql:8.0" - { source: "registry", dest: "registry", tag: "2" }
- "mariadb:10.4" - { source: "mysql", dest: "mysql", tag: "5.7" }
- "postgres:12" - { source: "mysql", dest: "mysql", tag: "8.0" }
- name: Build mysql 5.7 backup image - { source: "mariadb", dest: "mariadb", tag: "10.4" }
- { source: "postgres", dest: "postgres", tag: "12" }
- name: build and push trove backup images
become: true 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: args:
chdir: "{{ ansible_user_dir }}/src/opendev.org/openstack/trove/backup" DATASTORE: "{{ item.datastore }}"
- name: Build mysql 8.0 backup image DATASTORE_VERSION: "{{ item.version }}"
become: true name: "quay.io/openstack.trove/{{ item.backup_image }}"
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 . tag: "{{ item.version }}"
args: push: true
chdir: "{{ ansible_user_dir }}/src/opendev.org/openstack/trove/backup" source: build
- 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}}
loop: loop:
- "mariadb:1.1.0" - { datastore: "mysql", backup_image: "db-backup-mysql", version: "5.7" }
- "postgresql:1.1.2" - { datastore: "mysql", backup_image: "db-backup-mysql",version: "8.0" }
- name: Push mysql backup images - { datastore: "mariadb", backup_image: "db-backup-mariadb", version: "10.4" }
become: true - { datastore: "postgres", backup_image: "db-backup-posrgresql", version: "12" }
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"

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" image_suffix: "-dev"
- job: - job:
name: publish-trove-datastore-images name: publish-trove-images-quay
description: | description: |
Build and publish trove datastore docker images to Build and sync trove images to quay.io/openstack.trove.
tarballs.openstack.org. pre-run: playbooks/image-build/pre.yaml
run: playbooks/image-build/docker-registry.yaml run: playbooks/image-build/docker-registry.yaml
parent: publish-openstack-artifacts
post-run: playbooks/image-build/post.yaml
nodeset: trove-ubuntu-noble-single nodeset: trove-ubuntu-noble-single
required-projects: required-projects:
- openstack/trove - openstack/trove
secrets:
- trove_quay_io_creds

View File

@ -23,3 +23,29 @@
- name: tempest - name: tempest
nodes: nodes:
- controller - 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: branches:
regex: ^stable/.*$ regex: ^stable/.*$
negate: true negate: true
- publish-trove-datastore-images: - publish-trove-images-quay:
branches: branches:
regex: ^stable/.*$ regex: ^stable/.*$
negate: true negate: true