Skip to content

Commit 0ad2bb3

Browse files
authored
Merge pull request #35 from zzorica/allow-private-helm-repo-auth-in-dependencies
Allow private helm repo auth in dependencies
2 parents a5c9252 + 86e9903 commit 0ad2bb3

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Inputs:
2020
* `chart_version` Explicitly specify chart version in package. If not defined then used chart values.
2121
* `index_dir` The location of `index.yaml` file in the repo, defaults to the same value as `target_dir`
2222
* `enterprise_url` The URL of enterprise github server in the format `<server-url>/<organisation>`
23-
* `dependencies` A list of helm repositories required to verify dependencies in the format `<name>,<url>;<name>,<url>`
23+
* `dependencies` A list of helm repositories required to verify dependencies in the format `<name>,<url>;<name>,<url>` or if using private repositories `<name>,<username>,<password>,<url>;<name>,<username>,<password>,<url>`. Combinations are allowed.
2424

2525
## Examples
2626

action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ inputs:
3535
commit_username:
3636
description: "The user name used for the commit user"
3737
required: false
38-
default: ${{ github.actor }}
38+
default: ${{ github.actor }}
3939
commit_email:
4040
description: "The email used for the commit user"
4141
required: false
@@ -54,7 +54,7 @@ inputs:
5454
required: false
5555
dependencies:
5656
description: "A list of helm repositories required to verify dependencies in the format '<name>,<url>;<name>,<url>'"
57-
required: false
57+
required: false
5858
runs:
5959
using: 'docker'
6060
image: 'Dockerfile'

src/entrypoint.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ main() {
7575
if [[ -z "$REPO_URL" ]]; then
7676
if [[ -z "$ENTERPRISE_URL" ]]; then
7777
REPO_URL="https://x-access-token:${GITHUB_TOKEN}@github.com/${OWNER}/${REPOSITORY}"
78-
else
78+
else
7979
REPO_URL="https://x-access-token:${GITHUB_TOKEN}@${ENTERPRISE_URL}/${REPOSITORY}"
80-
fi
80+
fi
8181
fi
8282

8383
if [[ -z "$COMMIT_USERNAME" ]]; then
@@ -129,9 +129,18 @@ download() {
129129
get_dependencies() {
130130
IFS=';' read -ra dependency <<< "$DEPENDENCIES"
131131
for repos in ${dependency[@]}; do
132-
name=$(cut -f 1 -d, <<< "$repos")
133-
url=$(cut -f 2 -d, <<< "$repos")
134-
helm repo add ${name} ${url}
132+
result=$( echo $repos|awk -F',' '{print NF}' )
133+
if [[ $result -gt 2 ]]; then
134+
name=$(cut -f 1 -d, <<< "$repos")
135+
username=$(cut -f 2 -d, <<< "$repos")
136+
password=$(cut -f 3 -d, <<< "$repos")
137+
url=$(cut -f 4 -d, <<< "$repos")
138+
helm repo add ${name} --username ${username} --password ${password} ${url}
139+
else
140+
name=$(cut -f 1 -d, <<< "$repos")
141+
url=$(cut -f 2 -d, <<< "$repos")
142+
helm repo add ${name} ${url}
143+
fi
135144
done
136145
}
137146

0 commit comments

Comments
 (0)