Skip to content

Instantly share code, notes, and snippets.

@jdolitsky
Last active January 15, 2018 07:22
Show Gist options
  • Save jdolitsky/e3cb82ffad6b84a0f01e2866c1f280bd to your computer and use it in GitHub Desktop.
Save jdolitsky/e3cb82ffad6b84a0f01e2866c1f280bd to your computer and use it in GitHub Desktop.
version: '1.0'
steps:
create_chart_package:
image: codefresh/plugin-helm:2.7.2
commands:
# Repo name may not necessarily match the chart name, but the "helm package"
# command requires the current directory and the chart name to match. So we
# extract the chart name from Chart.yaml, then create a working directory for
# us to use with that name.
- NAME=$(cat Chart.yaml | grep -m 1 ^name:| awk '{print $2}')
- ln -s /codefresh/volume/${{CF_REPO_NAME}} /tmp/$NAME && cd /tmp/$NAME
# Set a new version in Chart.yaml specifying this as a candidate for the next
# release, assuming the next version will increment the patch version by 1.
# Use the timestamp of the build for sorting purposes in other pipelines.
- VERSION=$(cat Chart.yaml | grep -m 1 ^version:| awk '{print $2}')
- NEW_VERSION="${VERSION%.*}.$(expr ${VERSION##*.} + 1)-rc${{CF_BUILD_TIMESTAMP}}"
- sed -i "s/$VERSION/$NEW_VERSION/g" Chart.yaml
# Create .tgz package, export CHART_NAME var used by codefresh/plugin-helm
- helm init --client-only
- >-
helm repo add incubator
https://kubernetes-charts-incubator.storage.googleapis.com/
- helm dep up
- helm package .
- cf_export NAME=$NAME CHART_NAME="$NAME-$NEW_VERSION.tgz"
deploy_to_staging:
image: codefresh/plugin-helm:2.7.2
release_chart_package:
image: codefresh/plugin-helm:2.7.2
commands:
- apk --no-cache add curl
- kubectl config use-context ${{KUBE_CONTEXT}}
- >-
CM_URL="http://$(kubectl -n ${{NAMESPACE}}
get service "${{RELEASE_NAME}}-${{NAME}}"
-o=jsonpath='{.status.loadBalancer.ingress[0].ip}'):8080"
- curl --fail -v --data-binary "@${{CHART_NAME}}" $CM_URL/api/charts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment