diff --git a/Makefile b/Makefile index 06974d4a2..356035a8e 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,12 @@ lint-%: init-% build-%: lint-% if [ -d $* ]; then $(HELM) package $*; fi +# Note: user running helm3 can package the charts, but can run into helm lint +# issue due to stricter logic in helm3. This adds a target to package charts +# without executing a lint until the issues are fixed. +package-%: init-% + if [ -d $* ]; then $(HELM) package $*; fi + clean: @echo "Removed .b64, _partials.tpl, and _globals.tpl files" rm -f helm-toolkit/secrets/*.b64 diff --git a/playbooks/build-chart.yaml b/playbooks/build-chart.yaml new file mode 100644 index 000000000..55d728a90 --- /dev/null +++ b/playbooks/build-chart.yaml @@ -0,0 +1,41 @@ +--- +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +- hosts: all + tasks: + - name: install helm3 + become_user: root + shell: | + TMP_DIR=$(mktemp -d) + curl -sSL https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz | tar -zxv --strip-components=1 -C ${TMP_DIR} + sudo mv ${TMP_DIR}/helm /usr/bin/helm + rm -rf ${TMP_DIR} + environment: + HELM_VERSION: "v3.3.4" + args: + executable: /bin/bash + + # Note: This needs to be adjusted once the initial tarball is seeded. + - name: updates the requirements due to the lack of helm serve in helm 3 + shell: | + find . -type f -name "requirements.yaml" -exec sed -i "s#http://localhost:8879/charts#file://../helm-toolkit#g" {} \; + args: + executable: /bin/bash + + - name: make all + make: + chdir: "{{ zuul.project.src_dir }}" + target: all + params: + TASK: package +... diff --git a/playbooks/publish/post.yaml b/playbooks/publish/post.yaml index 11e2574e8..6e322fd1d 100644 --- a/playbooks/publish/post.yaml +++ b/playbooks/publish/post.yaml @@ -24,11 +24,20 @@ - name: Create a new index when: _get_url.status_code == 404 - shell: helm repo index {{ zuul.project.src_dir }} + shell: helm repo index {{ zuul.project.src_dir }} --url https://tarballs.opendev.org/openstack/openstack-helm-infra - name: Merge into existing index when: _get_url.status_code == 200 - shell: helm repo index {{ zuul.project.src_dir }} --merge {{ zuul.project.src_dir }}/index.yaml + shell: helm repo index {{ zuul.project.src_dir }} --merge {{ zuul.project.src_dir }}/index.yaml --url https://tarballs.opendev.org/openstack/openstack-helm-infra + + # TODO: Remove this once HTK is seeded in tarballs.o.o + - name: Update the HTK dependencies + shell: | + sed -i 's#file://../helm-toolkit#https://tarballs.opendev.org/openstack/openstack-helm-infra#g' index.yaml + chdir: + args: + executable: /bin/bash + chdir: "{{ zuul.project.src_dir }}" - name: Update Helm repository synchronize: diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index cb04a0615..dee197899 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -28,7 +28,9 @@ - job: name: publish-openstack-helm-charts parent: publish-openstack-artifacts - run: playbooks/publish/run.yaml + run: playbooks/build-chart.yaml + required-projects: + - openstack/openstack-helm-infra post-run: playbooks/publish/post.yaml - job: