-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
56 lines (49 loc) · 1.5 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: MondoPower/argocd
author: MondoPower
description: 'Setup argocd'
inputs:
username:
description: 'A argocd username'
required: true
password:
description: 'Password for the assigned argocd username'
required: true
namespace:
description: 'namespace of argo instance'
required: true
commands:
description: 'argo commands to run. ; delimited'
required: false
default: ''
outputs:
argocd:
description: "Argocd path"
value: ${{ steps.setup-argocd.outputs.argocd }}
runs:
using: "composite"
steps:
- name: Setup ArgoCD Cli
id: setup-argocd
shell: bash
run: |
curl -sSL -o /tmp/argocd https://github.com/argoproj/argo-cd/releases/download/v1.7.14/argocd-linux-amd64
chmod +x /tmp/argocd
echo "::set-output name=argocd::/tmp/argocd"
export PATH=$PATH:/tmp
OPTIONS="--port-forward-namespace ${{ inputs.namespace }} --port-forward --plaintext"
echo "::set-output name=options::$OPTIONS"
argocd login --username '${{ inputs.username }}' --password '${{ inputs.password }}' $OPTIONS
if [[ -n "${{ inputs.commands }}" ]]; then
IFS=";"
read -r -a array <<< "${{ inputs.commands }}"
for i in "${array[@]}"
do
if [[ $i =~ " -- " ]]; then
command="${i/ -- / ${OPTIONS} -- }"
else
command="${i} ${OPTIONS}"
fi
echo $command
eval $command
done
fi