openstack-helm-infra/tools/gate/playbooks/build-helm-packages/tasks/setup-helm-serve.yaml
intlabs 2029e94d1b Gate: force use of bash for ansible script module use
This PS forces the use of bash for ansible tasks that use the
script module.

Change-Id: I131768d48081834806eeb912d84c562eeada1f46
2017-11-13 13:17:54 -06:00

71 lines
2.5 KiB
YAML

# 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.
- block:
- name: check if correct version of helm client already installed
shell: "set -e; [ \"x$($(type -p helm) version --client --short | awk '{ print $NF }' | awk -F '+' '{ print $1 }')\" == \"x${HELM_VERSION}\" ] || exit 1"
environment:
HELM_VERSION: "{{ version.helm }}"
args:
executable: /bin/bash
register: need_helm
ignore_errors: True
- name: install helm client
when: need_helm | failed
become_user: root
shell: |
TMP_DIR=$(mktemp -d)
curl -sSL https://storage.googleapis.com/kubernetes-helm/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: "{{ version.helm }}"
args:
executable: /bin/bash
- name: setting up helm client
command: helm init --client-only
- block:
- name: checking if local helm server is running
shell: curl -s 127.0.0.1:8879 | grep -q 'Helm Repository'
args:
executable: /bin/bash
register: helm_server_running
ignore_errors: True
- name: launching local helm server via shell
when: helm_server_running | failed
shell: helm serve &
args:
executable: /bin/bash
- name: wait for helm server to be ready
shell: curl -s 127.0.0.1:8879 | grep -q 'Helm Repository'
args:
executable: /bin/bash
register: wait_for_helm_server
until: wait_for_helm_server.rc == 0
retries: 120
delay: 5
- block:
- name: checking if helm 'stable' repo is present
shell: helm repo list | grep -q "^stable"
args:
executable: /bin/bash
register: helm_stable_repo_present
ignore_errors: True
- name: checking if helm 'stable' repo is present
when: helm_stable_repo_present | succeeded
command: helm repo remove stable
- name: adding helm local repo
command: helm repo add local http://localhost:8879/charts