[CI] optimize the image build script

using --build-arg which was provided by docker to
replace the sed tool

Change-Id: I93c8c98001d82d802b91ba2a4d042149cff36da4
This commit is contained in:
wu.chunyang 2023-07-25 13:51:55 +08:00
parent c4efd57e36
commit 40363f870d

View File

@ -28,25 +28,22 @@
- "postgres:12" - "postgres:12"
- name: Build mysql 5.7 backup image - name: Build mysql 5.7 backup image
become: true 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: args:
chdir: "{{ ansible_user_dir }}/src/opendev.org/openstack/trove/backup" chdir: "{{ ansible_user_dir }}/src/opendev.org/openstack/trove/backup"
- name: Build mysql 8.0 backup image - name: Build mysql 8.0 backup image
become: true become: true
shell: sed -i s/mysql5.7/mysql8.0/ Dockerfile && \ shell: docker build -t 127.0.0.1:5000/trove-datastores/db-backup-mysql8.0:1.1.0 --build-arg DATASTORE=mysql8.0 .
docker build -t 127.0.0.1:5000/trove-datastores/db-backup-mysql8.0:1.1.0 .
args: args:
chdir: "{{ ansible_user_dir }}/src/opendev.org/openstack/trove/backup" chdir: "{{ ansible_user_dir }}/src/opendev.org/openstack/trove/backup"
- name: Build mariadb backup image - name: Build mariadb backup image
become: true become: true
shell: sed -i s/mysql8.0/mariadb/ Dockerfile && \ shell: docker build -t 127.0.0.1:5000/trove-datastores/db-backup-mariadb:1.1.0 --build-arg DATASTORE=mariadb .
docker build -t 127.0.0.1:5000/trove-datastores/db-backup-mariadb:1.1.0 .
args: args:
chdir: "{{ ansible_user_dir }}/src/opendev.org/openstack/trove/backup" chdir: "{{ ansible_user_dir }}/src/opendev.org/openstack/trove/backup"
- name: Build postgresql backup image - name: Build postgresql backup image
become: true become: true
shell: sed -i s/mariadb/postgresql/ Dockerfile && \ shell: docker build -t 127.0.0.1:5000/trove-datastores/db-backup-postgresql:1.1.2 --build-arg DATASTORE=postgresql .
docker build -t 127.0.0.1:5000/trove-datastores/db-backup-postgresql:1.1.2 .
args: args:
chdir: "{{ ansible_user_dir }}/src/opendev.org/openstack/trove/backup" chdir: "{{ ansible_user_dir }}/src/opendev.org/openstack/trove/backup"
- name: Push the backup images - name: Push the backup images