From 5f5178c947baf1f6f03ed1781fe84135fb2a3c26 Mon Sep 17 00:00:00 2001 From: Andres Date: Mon, 28 May 2018 17:56:01 +0200 Subject: [PATCH] Add kinesis yaml in the release process. Other minor fixes (#786) * Add kinesis yaml in the release process. Other minor fixes * Fix build --- .circleci/config.yml | 13 +++++-------- script/create_release.sh | 10 +++------- script/release_utils.sh | 2 +- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a895ec5d1..8713b3cfa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -18,6 +18,7 @@ defaults: &defaults TEST_DEBUG: "1" GKE_VERSION: 1.8.8-gke.0 MINIKUBE_VERSION: v0.25.2 + MANIFESTS: kubeless kubeless-non-rbac kubeless-openshift kafka-zookeeper kafka-zookeeper-openshift nats kinesis exports: &exports # It is not possible to resolve env vars in the environment section: # https://discuss.circleci.com/t/using-environment-variables-in-config-yml-not-working/14237 @@ -162,14 +163,10 @@ jobs: - run: make all-yaml - run: | mkdir build-manifests - manifests=( - kubeless.yaml kubeless-non-rbac.yaml kubeless-openshift.yaml - kafka-zookeeper.yaml kafka-zookeeper-openshift.yaml - nats.yaml kinesis.yaml - ) + IFS=' ' read -r -a manifests <<< "$MANIFESTS" for f in "${manifests[@]}"; do - sed -i.bak 's/:latest/'":${CONTROLLER_TAG}"'/g' $f - cp $f build-manifests/ + sed -i.bak 's/:latest/'":${CONTROLLER_TAG}"'/g' ${f}.yaml + cp ${f}.yaml build-manifests/ done - persist_to_workspace: root: /home/circleci/.go_workspace @@ -324,4 +321,4 @@ jobs: - <<: *restore_workspace - run: make VERSION=${CIRCLE_TAG} binary-cross - run: for d in bundles/kubeless_*; do zip -r9 $d.zip $d/; done - - run: ./script/create_release.sh ${CIRCLE_TAG} + - run: ./script/create_release.sh ${CIRCLE_TAG} "${MANIFESTS}" diff --git a/script/create_release.sh b/script/create_release.sh index 46d3b61c6..4534ac507 100755 --- a/script/create_release.sh +++ b/script/create_release.sh @@ -1,10 +1,10 @@ #!/bin/bash set -e -# TODO: Use kubeless REPO_NAME=kubeless REPO_DOMAIN=kubeless TAG=${1:?} +MANIFESTS=${2:?} # Space separated list of manifests to publish PROJECT_DIR=$(cd $(dirname $0)/.. && pwd) @@ -25,14 +25,10 @@ if [[ $repo_check == *"Not Found"* ]]; then echo "Not found a Github repository for $REPO_DOMAIN/$REPO_NAME, it is not possible to publish it" > /dev/stderr exit 1 else - RELEASE_ID=$(release_tag $1 $REPO_DOMAIN $REPO_NAME | jq '.id') + RELEASE_ID=$(release_tag $TAG $REPO_DOMAIN $REPO_NAME | jq '.id') fi -manifests=( - kubeless kubeless-non-rbac kubeless-openshift - kafka-zookeeper kafka-zookeeper-openshift - nats - ) +IFS=' ' read -r -a manifests <<< "$MANIFESTS" for f in "${manifests[@]}"; do cp ${PROJECT_DIR}/${f}.yaml ${PROJECT_DIR}/${f}-${TAG}.yaml upload_asset $REPO_DOMAIN $REPO_NAME "$RELEASE_ID" "${PROJECT_DIR}/${f}-${TAG}.yaml" diff --git a/script/release_utils.sh b/script/release_utils.sh index 42da2ac67..08f516939 100755 --- a/script/release_utils.sh +++ b/script/release_utils.sh @@ -77,7 +77,7 @@ function release_tag { local repo_domain=${2:?} local repo_name=${3:?} local body=$(get_release_body $tag $repo_domain $repo_name) - local release=`curl -H "Authorization: token $ACCESS_TOKEN" -s --request POST --data "$body" https://api.github.com/repos/$REPO_DOMAIN/$REPO_NAME/releases` + local release=`curl -H "Authorization: token $ACCESS_TOKEN" -s --request POST --data "$body" https://api.github.com/repos/$repo_domain/$repo_name/releases` echo $release }