From 3560773c3a61db667b1076fd3496996c5a4e5f82 Mon Sep 17 00:00:00 2001 From: Paul Carlton Date: Thu, 29 Sep 2022 15:27:58 +0100 Subject: [PATCH 1/9] debugging --- src/entrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/entrypoint.sh b/src/entrypoint.sh index 8503afa..ca0c344 100644 --- a/src/entrypoint.sh +++ b/src/entrypoint.sh @@ -16,6 +16,7 @@ set -o errexit set -o pipefail +set -x GITHUB_TOKEN=$1 CHARTS_DIR=$2 @@ -150,6 +151,7 @@ upload() { tmpDir=$(mktemp -d) pushd $tmpDir >& /dev/null + echo "REPO_URL=$REPO_URL" git clone ${REPO_URL} cd ${REPOSITORY} git config user.name "${COMMIT_USERNAME}" From fe6e91aa1791858c8b92d1da95e3cf6f3d23f077 Mon Sep 17 00:00:00 2001 From: Paul Carlton Date: Fri, 30 Sep 2022 13:31:15 +0100 Subject: [PATCH 2/9] add repo add --- src/entrypoint.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/entrypoint.sh b/src/entrypoint.sh index ca0c344..0f3ff38 100644 --- a/src/entrypoint.sh +++ b/src/entrypoint.sh @@ -94,6 +94,7 @@ main() { locate download + get_repo dependencies if [[ "$LINTING" != "off" ]]; then lint @@ -125,6 +126,10 @@ download() { rm -rf $tmpDir } +get_repo() { + helm repo add matrixx https://raw.githubusercontent.com/weaveworks-20276/customer-info/gh-pages --username paul-calton --password ${GITHUB_TOKEN} +} + dependencies() { for chart in ${CHARTS[@]}; do helm dependency update "${chart}" From 4eb2ac07b258b71344e0aca37a017b4ca25b2160 Mon Sep 17 00:00:00 2001 From: Paul Carlton Date: Fri, 30 Sep 2022 15:52:23 +0100 Subject: [PATCH 3/9] add origin/.. to checkout --- src/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entrypoint.sh b/src/entrypoint.sh index 0f3ff38..183f865 100644 --- a/src/entrypoint.sh +++ b/src/entrypoint.sh @@ -162,7 +162,7 @@ upload() { git config user.name "${COMMIT_USERNAME}" git config user.email "${COMMIT_EMAIL}" git remote set-url origin ${REPO_URL} - git checkout ${BRANCH} + git checkout origin/${BRANCH} -b ${BRANCH} charts=$(cd ${CHARTS_TMP_DIR} && ls *.tgz | xargs) From 3d3bd42a7613e3f51f975a2ffe0ab7851906c1a1 Mon Sep 17 00:00:00 2001 From: Paul Carlton Date: Fri, 30 Sep 2022 16:31:29 +0100 Subject: [PATCH 4/9] add origin/.. to checkout --- src/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entrypoint.sh b/src/entrypoint.sh index 183f865..0f3ff38 100644 --- a/src/entrypoint.sh +++ b/src/entrypoint.sh @@ -162,7 +162,7 @@ upload() { git config user.name "${COMMIT_USERNAME}" git config user.email "${COMMIT_EMAIL}" git remote set-url origin ${REPO_URL} - git checkout origin/${BRANCH} -b ${BRANCH} + git checkout ${BRANCH} charts=$(cd ${CHARTS_TMP_DIR} && ls *.tgz | xargs) From 13eb32b03be06d80a3b229ce2f121efd935b5645 Mon Sep 17 00:00:00 2001 From: Paul Carlton Date: Tue, 4 Oct 2022 13:43:32 +0100 Subject: [PATCH 5/9] add dependencies --- src/entrypoint.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/entrypoint.sh b/src/entrypoint.sh index 0f3ff38..133a6e1 100644 --- a/src/entrypoint.sh +++ b/src/entrypoint.sh @@ -33,6 +33,7 @@ APP_VERSION=${12} CHART_VERSION=${13} INDEX_DIR=${14} ENTERPRISE_URL=${15} +DEPENDENCIES=${$16} CHARTS=() CHARTS_TMP_DIR=$(mktemp -d) @@ -126,8 +127,13 @@ download() { rm -rf $tmpDir } -get_repo() { - helm repo add matrixx https://raw.githubusercontent.com/weaveworks-20276/customer-info/gh-pages --username paul-calton --password ${GITHUB_TOKEN} +get_dependencies() { + IFS=';' read -ra depenency <<< "$DEPENDENCIES" + for repos in ${dependency[@]}; do + name=$(cut -f 1 -d, <<< "$repos") + url=$(cut -f 2 -d, <<< "$repos") + helm repo add ${name} ${url} + done } dependencies() { @@ -183,7 +189,7 @@ upload() { git add ${INDEX_DIR}/index.yaml git commit -m "Publish $charts" - git push origin ${BRANCH} + git push ${BRANCH} popd >& /dev/null rm -rf $tmpDir From ce5cd1646e707ee9ecc00f40acbc1edc313a4e62 Mon Sep 17 00:00:00 2001 From: Paul Carlton Date: Tue, 4 Oct 2022 13:56:53 +0100 Subject: [PATCH 6/9] add dependencies --- README.md | 1 + action.yml | 6 +++++- src/entrypoint.sh | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4526bfc..ece8024 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Inputs: * `chart_version` Explicitly specify chart version in package. If not defined then used chart values. * `index_dir` The location of `index.yaml` file in the repo, defaults to the same value as `target_dir` * `enterprise_url` The URL of enterprise github server in the format `/` +* `dependencies` A list of helm repositories required to verify dependencies in the format `,;,` ## Examples diff --git a/action.yml b/action.yml index e8209e9..807bc23 100644 --- a/action.yml +++ b/action.yml @@ -51,7 +51,10 @@ inputs: required: false enterprise_url: description: "The URL of enterprise github server in the format '/'" - required: false + required: false + dependencies: + description: "A list of helm repositories required to verify dependencies in the format ',;,'" + required: false runs: using: 'docker' image: 'Dockerfile' @@ -71,3 +74,4 @@ runs: - ${{ inputs.chart_version }} - ${{ inputs.index_dir }} - ${{ inputs.enterprise_url }} + - ${{ inputs.dependencies }} diff --git a/src/entrypoint.sh b/src/entrypoint.sh index 133a6e1..6569a07 100644 --- a/src/entrypoint.sh +++ b/src/entrypoint.sh @@ -95,7 +95,7 @@ main() { locate download - get_repo + get_dependencies dependencies if [[ "$LINTING" != "off" ]]; then lint From a77eeb96302211474cae657c3318ed700025bc8b Mon Sep 17 00:00:00 2001 From: Paul Carlton Date: Tue, 4 Oct 2022 13:59:20 +0100 Subject: [PATCH 7/9] add dependencies --- src/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entrypoint.sh b/src/entrypoint.sh index 6569a07..098af04 100644 --- a/src/entrypoint.sh +++ b/src/entrypoint.sh @@ -33,7 +33,7 @@ APP_VERSION=${12} CHART_VERSION=${13} INDEX_DIR=${14} ENTERPRISE_URL=${15} -DEPENDENCIES=${$16} +DEPENDENCIES=${16} CHARTS=() CHARTS_TMP_DIR=$(mktemp -d) From aa539260428975df4d46ac611d52ffc92403174f Mon Sep 17 00:00:00 2001 From: Paul Carlton Date: Tue, 4 Oct 2022 14:04:07 +0100 Subject: [PATCH 8/9] add dependencies --- src/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entrypoint.sh b/src/entrypoint.sh index 098af04..c0dc945 100644 --- a/src/entrypoint.sh +++ b/src/entrypoint.sh @@ -128,7 +128,7 @@ download() { } get_dependencies() { - IFS=';' read -ra depenency <<< "$DEPENDENCIES" + IFS=';' read -ra dependency <<< "$DEPENDENCIES" for repos in ${dependency[@]}; do name=$(cut -f 1 -d, <<< "$repos") url=$(cut -f 2 -d, <<< "$repos") From 84568715a3046d58d695e521b69a824f1550c0e7 Mon Sep 17 00:00:00 2001 From: Paul Carlton Date: Tue, 4 Oct 2022 14:22:53 +0100 Subject: [PATCH 9/9] add dependencies --- src/entrypoint.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/entrypoint.sh b/src/entrypoint.sh index c0dc945..e720cd2 100644 --- a/src/entrypoint.sh +++ b/src/entrypoint.sh @@ -16,7 +16,6 @@ set -o errexit set -o pipefail -set -x GITHUB_TOKEN=$1 CHARTS_DIR=$2 @@ -162,7 +161,6 @@ upload() { tmpDir=$(mktemp -d) pushd $tmpDir >& /dev/null - echo "REPO_URL=$REPO_URL" git clone ${REPO_URL} cd ${REPOSITORY} git config user.name "${COMMIT_USERNAME}" @@ -189,7 +187,7 @@ upload() { git add ${INDEX_DIR}/index.yaml git commit -m "Publish $charts" - git push ${BRANCH} + git push origin ${BRANCH} popd >& /dev/null rm -rf $tmpDir