From 40363f870d2f8c8a594ef342e5f72e4d1b95e320 Mon Sep 17 00:00:00 2001 From: "wu.chunyang" Date: Tue, 25 Jul 2023 13:51:55 +0800 Subject: [PATCH] [CI] optimize the image build script using --build-arg which was provided by docker to replace the sed tool Change-Id: I93c8c98001d82d802b91ba2a4d042149cff36da4 --- playbooks/image-build/docker-registry.yaml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/playbooks/image-build/docker-registry.yaml b/playbooks/image-build/docker-registry.yaml index 71b172407c..c16f6f905a 100644 --- a/playbooks/image-build/docker-registry.yaml +++ b/playbooks/image-build/docker-registry.yaml @@ -28,25 +28,22 @@ - "postgres:12" - name: Build mysql 5.7 backup image become: true - shell: docker build -t 127.0.0.1:5000/trove-datastores/db-backup-mysql5.7:1.1.0 . + shell: docker build -t 127.0.0.1:5000/trove-datastores/db-backup-mysql5.7:1.1.0 --build-arg DATASTORE=mysql5.7 . args: chdir: "{{ ansible_user_dir }}/src/opendev.org/openstack/trove/backup" - name: Build mysql 8.0 backup image become: true - shell: sed -i s/mysql5.7/mysql8.0/ Dockerfile && \ - docker build -t 127.0.0.1:5000/trove-datastores/db-backup-mysql8.0:1.1.0 . + shell: docker build -t 127.0.0.1:5000/trove-datastores/db-backup-mysql8.0:1.1.0 --build-arg DATASTORE=mysql8.0 . args: chdir: "{{ ansible_user_dir }}/src/opendev.org/openstack/trove/backup" - name: Build mariadb backup image become: true - shell: sed -i s/mysql8.0/mariadb/ Dockerfile && \ - docker build -t 127.0.0.1:5000/trove-datastores/db-backup-mariadb:1.1.0 . + shell: docker build -t 127.0.0.1:5000/trove-datastores/db-backup-mariadb:1.1.0 --build-arg DATASTORE=mariadb . args: chdir: "{{ ansible_user_dir }}/src/opendev.org/openstack/trove/backup" - name: Build postgresql backup image become: true - shell: sed -i s/mariadb/postgresql/ Dockerfile && \ - docker build -t 127.0.0.1:5000/trove-datastores/db-backup-postgresql:1.1.2 . + shell: docker build -t 127.0.0.1:5000/trove-datastores/db-backup-postgresql:1.1.2 --build-arg DATASTORE=postgresql . args: chdir: "{{ ansible_user_dir }}/src/opendev.org/openstack/trove/backup" - name: Push the backup images