diff --git a/.zuul.yaml b/.zuul.yaml index df9f33e..9bbb9b2 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,15 +1,3 @@ -- job: - name: manila-image-elements-buildimage-docker - parent: legacy-base - run: playbooks/manila-buildimage-docker/run.yaml - timeout: 1800 - -- job: - name: manila-image-elements-buildimage-generic - parent: legacy-base - run: playbooks/manila-buildimage-generic/run.yaml - timeout: 1800 - - project: templates: - check-requirements @@ -37,4 +25,38 @@ - manila-image-elements-buildimage-generic post: jobs: - - legacy-manila-publishimage-generic + - manila-image-elements-publish-artifacts + +- job: + name: manila-image-elements-buildimage-docker + description: | + Build docker image for the "container" manila back end. + parent: unittests + timeout: 1800 + required-projects: + - openstack/manila-image-elements + run: playbooks/manila-buildimage-docker/run.yaml + +- job: + name: manila-image-elements-buildimage-generic + description: | + Build service image for the "generic" manila back end. + parent: unittests + timeout: 1800 + required-projects: + - openstack/manila-image-elements + run: playbooks/manila-buildimage-generic/run.yaml + +- job: + name: manila-image-elements-publish-artifacts + description: | + Build image artifacts and publish to tarballs.openstack.org + parent: publish-openstack-artifacts + timeout: 3600 + final: true + required-projects: + - openstack/manila-image-elements + run: playbooks/manila-buildimage-generic/run.yaml + post-run: playbooks/manila-publish-artifacts/post.yaml + + diff --git a/playbooks/manila-buildimage-docker/run.yaml b/playbooks/manila-buildimage-docker/run.yaml index b57b383..d2ae71d 100644 --- a/playbooks/manila-buildimage-docker/run.yaml +++ b/playbooks/manila-buildimage-docker/run.yaml @@ -1,49 +1,6 @@ - hosts: all - name: Autoconverted job legacy-manila-buildimage-docker from old job gate-manila-buildimage-docker-ubuntu-xenial - roles: - - bindep - tasks: - - - name: Ensure legacy workspace directory - file: - path: '{{ ansible_user_dir }}/workspace' - state: directory - - - shell: - cmd: | - set -e - set -x - CLONEMAP=`mktemp` - function cleanup { - # In cases where zuul-cloner is aborted during a git - # clone operation, git will remove the git work tree in - # its cleanup. The work tree in these jobs is the - # workspace directory, which means that subsequent - # jenkins post-build actions can not run because the - # workspace has been removed. - # To reduce the likelihood of this having an impact, - # recreate the workspace directory if needed - mkdir -p $WORKSPACE - rm -f $CLONEMAP - } - trap cleanup EXIT - cat > $CLONEMAP << EOF - clonemap: - - name: $ZUUL_PROJECT - dest: . - EOF - /usr/zuul-env/bin/zuul-cloner -m $CLONEMAP --cache-dir /opt/git \ - git://git.openstack.org $ZUUL_PROJECT - executable: /bin/bash - chdir: '{{ ansible_user_dir }}/workspace' - environment: '{{ zuul | zuul_legacy_vars }}' - - - shell: - cmd: | - set -e - set -x - ./tools/gate/build-images docker - executable: /bin/bash - chdir: '{{ ansible_user_dir }}/workspace' - environment: '{{ zuul | zuul_legacy_vars }}' + - name: Run tools/gate/build-images docker + command: bash -xe tools/gate/build-images docker + args: + chdir: '{{ zuul.project.src_dir }}' diff --git a/playbooks/manila-buildimage-generic/run.yaml b/playbooks/manila-buildimage-generic/run.yaml index 054b217..882801f 100644 --- a/playbooks/manila-buildimage-generic/run.yaml +++ b/playbooks/manila-buildimage-generic/run.yaml @@ -1,49 +1,39 @@ - hosts: all - name: Autoconverted job legacy-manila-buildimage-generic from old job gate-manila-buildimage-generic-ubuntu-xenial - roles: - - bindep - tasks: - - - name: Ensure legacy workspace directory + - name: Run tools/gate/build-images generic + command: bash -xe tools/gate/build-images generic + args: + chdir: '{{ zuul.project.src_dir }}' + - name: create images directory file: - path: '{{ ansible_user_dir }}/workspace' + path: '{{ zuul.project.src_dir }}/images' state: directory - - - shell: - cmd: | - set -e - set -x - CLONEMAP=`mktemp` - function cleanup { - # In cases where zuul-cloner is aborted during a git - # clone operation, git will remove the git work tree in - # its cleanup. The work tree in these jobs is the - # workspace directory, which means that subsequent - # jenkins post-build actions can not run because the - # workspace has been removed. - # To reduce the likelihood of this having an impact, - # recreate the workspace directory if needed - mkdir -p $WORKSPACE - rm -f $CLONEMAP - } - trap cleanup EXIT - cat > $CLONEMAP << EOF - clonemap: - - name: $ZUUL_PROJECT - dest: . - EOF - /usr/zuul-env/bin/zuul-cloner -m $CLONEMAP --cache-dir /opt/git \ - git://git.openstack.org $ZUUL_PROJECT - executable: /bin/bash - chdir: '{{ ansible_user_dir }}/workspace' - environment: '{{ zuul | zuul_legacy_vars }}' - - - shell: - cmd: | - set -e - set -x - ./tools/gate/build-images generic - executable: /bin/bash - chdir: '{{ ansible_user_dir }}/workspace' - environment: '{{ zuul | zuul_legacy_vars }}' + mode: 0755 + - name: Collect git tag + command: git describe --tags + args: + chdir: '{{ zuul.project.src_dir }}' + register: tagoutput + - name: show directory contents after the build + command: ls -lrt + args: + chdir: '{{ zuul.project.src_dir }}' + - name: get the source directory + command: pwd + args: + chdir: '{{ zuul.project.src_dir }}' + register: src_dir + - name: hard link to image from images directory using tag + file: + src: '{{ src_dir.stdout }}/manila-service-image.qcow2' + dest: '{{ src_dir.stdout }}/images/manila-service-image-{{ tagoutput.stdout }}.qcow2' + state: hard + - name: now symlink using "master" in place of tag + file: + src: '{{ src_dir.stdout }}/images/manila-service-image-{{ tagoutput.stdout }}.qcow2' + dest: '{{ src_dir.stdout }}/images/manila-service-image-master.qcow2' + state: link + - name: show contents of the image directory + command: ls -lrt + args: + chdir: '{{ src_dir.stdout }}/images' diff --git a/playbooks/manila-publish-artifacts/post.yaml b/playbooks/manila-publish-artifacts/post.yaml new file mode 100644 index 0000000..79c294f --- /dev/null +++ b/playbooks/manila-publish-artifacts/post.yaml @@ -0,0 +1,13 @@ +- hosts: all + name: Copy artifacts + tasks: + - synchronize: + dest: "{{ zuul.executor.work_root }}/artifacts/images/" + mode: pull + src: "{{ zuul.project.src_dir }}/images/" + copy_links: true + verify_host: true + rsync_opts: + - --filter=P, *.qcow2 + - --include=** + - --delete