-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaction.yml
More file actions
93 lines (93 loc) · 2.91 KB
/
action.yml
File metadata and controls
93 lines (93 loc) · 2.91 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: 'Deploy K8s Application'
description: 'Deploy Helm Charts and Other kubernetes resources on a Local K3D Cluster or a Remote K8s Cluster.'
branding:
icon: upload-cloud
color: blue
inputs:
install_local_cluster:
description: 'To Create Local K3D Cluster'
required: true
default: "true"
local_cluster_name:
description: 'Name of Cluster if using K3d Local cluster'
required: false
default: "mycluster"
local_cluster_args:
description: 'Args if using K3d Local Cluster'
required: false
default: >-
-p "8080:80@loadbalancer"
-p "9443:443@loadbalancer"
--api-port 6443
--servers 1
--agents 1
--verbose
--k3s-node-label "node=ondemand@server:0;agent:0"
--k3s-arg "--disable=traefik@server:0"
k3d-version:
description: 'Override Default k3d version'
required: false
default: v5.4.1
pre_commands:
description: 'Extra commands to run before installing helm charts'
required: false
default: ''
post_commands:
description: 'Extra commands to run after installing helm charts'
required: false
default: ''
kubeconfig:
description: 'Kubernetes Cluster Configuration File'
required: false
default: '/home/runner/.kube/config'
charts:
description: "Helm Charts to deploy. Using the following Yaml Syntax"
required: false
default: ''
catch_chart_errors:
description: "If to exit on unsuccesful helm chart installations "
required: false
default: "false"
runs:
using: "composite"
steps:
- name: Create k3d cluster
if: ${{ fromJSON(inputs.install_local_cluster) }}
uses: AbsaOSS/k3d-action@v2.3.0
with:
cluster-name: ${{inputs.local_cluster_name}}
args: ${{inputs.local_cluster_args}}
k3d-version: ${{inputs.k3d-version}}
- name: Generate KUBECONFIG File
run: |
if [[ ${{ fromJSON(inputs.install_local_cluster) }} ]]
then
echo "::set-output name=kubeconfig::$(cat $HOME/.kube/config)"
else
echo "::set-output name=kubeconfig::$(echo ${{inputs.kubeconfig}})"
fi
shell: bash
- name: pre commands
if: ${{ inputs.pre_commands }} != ''
shell: bash
run: |
${{inputs.pre_commands}}
env:
KUBECONFIG: ${{ steps.kubeconfig.outputs.kubeconfig }}
- run: python3 -m pip install gitpython
if: ${{ inputs.charts }} != ''
shell: bash
- run: python3 ${{ github.action_path }}/script.py
if: ${{ inputs.charts }} != ''
shell: bash
env:
KUBECONFIG: ${{ steps.kubeconfig.outputs.kubeconfig }}
CHARTS: ${{ inputs.charts }}
CATCH: ${{ inputs.catch_chart_errors }}
- name: post commands
if: ${{ inputs.post_commands }} != ''
shell: bash
run: |
${{inputs.post_commands}}
env:
KUBECONFIG: ${{ steps.kubeconfig.outputs.kubeconfig }}