From e23ece5e5542f930466a2b6149003a60f925d0fc Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Tue, 4 Jun 2019 07:48:52 -0700 Subject: [PATCH] Return javascript content artifact records to Zuul When producing javascript content tarballs, return artifact records to Zuul. Add a new job, build-javascript-content-tarball, which includes the role to fetch javascript content tarballs. Change-Id: Ia247054d0523b81916815151fd57138469f634e0 --- doc/source/js-jobs.rst | 1 + playbooks/javascript/tarball.yaml | 3 ++ .../tasks/main.yaml | 18 ++++++++++ zuul.yaml | 34 +++++++++++++++++++ 4 files changed, 56 insertions(+) create mode 100644 playbooks/javascript/tarball.yaml diff --git a/doc/source/js-jobs.rst b/doc/source/js-jobs.rst index 200648466..e78e84ab7 100644 --- a/doc/source/js-jobs.rst +++ b/doc/source/js-jobs.rst @@ -3,6 +3,7 @@ Javascript Jobs .. zuul:autojob:: build-javascript-tarball .. zuul:autojob:: build-javascript-content +.. zuul:autojob:: build-javascript-content-tarball .. zuul:autojob:: nodejs-npm .. zuul:autojob:: nodejs-npm-run-test .. zuul:autojob:: nodejs-npm-run-lint diff --git a/playbooks/javascript/tarball.yaml b/playbooks/javascript/tarball.yaml new file mode 100644 index 000000000..2ba7f711a --- /dev/null +++ b/playbooks/javascript/tarball.yaml @@ -0,0 +1,3 @@ +- hosts: all + roles: + - fetch-javascript-content-tarball diff --git a/roles/fetch-javascript-content-tarball/tasks/main.yaml b/roles/fetch-javascript-content-tarball/tasks/main.yaml index 8a9152f52..1eddd9d00 100644 --- a/roles/fetch-javascript-content-tarball/tasks/main.yaml +++ b/roles/fetch-javascript-content-tarball/tasks/main.yaml @@ -36,3 +36,21 @@ mode: pull src: "{{ zuul_work_dir }}/dist/" verify_host: true + +- name: Find content tarball + find: + file_type: file + paths: "{{ zuul_work_dir }}/dist/" + patterns: "*.tar.gz" + register: result + +- name: Return artifacts to Zuul + loop: "{{ result.files }}" + zuul_return: + data: + zuul: + artifacts: + - name: javascript_content + url: "{{ item.path | basename }}" + metadata: + type: javascript_content diff --git a/zuul.yaml b/zuul.yaml index bd1fccf15..0844790df 100644 --- a/zuul.yaml +++ b/zuul.yaml @@ -488,6 +488,40 @@ Directory, relative to zuul_work_dir, holding build content. success-url: npm/html/ +- job: + name: build-javascript-content-tarball + parent: nodejs-npm + description: | + Build an archive of javascript web content as it should be deployed. + + Responds to these variables: + + .. zuul:jobvar:: npm_command + :default: build + + Command to pass to npm. + + .. zuul:jobvar:: node_version + :default: 6 + + The version of Node to use. + + .. zuul:jobvar: zuul_work_dir + :default: {{ zuul.project.src_dir }} + + Path to operate in. + + .. zuul:jobvar: javascript_content_dir + :default: dist + + Directory, relative to zuul_work_dir, holding build content. + + .. zuul:jobvar: create_tarball_directory + + Create a tarball with the contents of + create_tarball_directory (relative to zuul_work_dir). + post-run: playbooks/javascript/tarball.yaml + - job: name: nodejs-npm-run-test parent: nodejs-npm