-
Notifications
You must be signed in to change notification settings - Fork 3
131 lines (118 loc) · 3.79 KB
/
deploy-aliyun-ack.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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: DEPLOY-ALIYUN-ACK
on:
push:
workflow_call:
inputs:
REGION:
description: "The k8s account region (eg: infracreate|beilian)"
type: string
required: false
default: 'infracreate'
MAKE_OPS:
description: "The ops name of makefile"
type: string
required: false
default: ''
MAKE_OPS_PRE:
description: "The pre ops name of makefile"
type: string
required: false
default: ''
VERSION:
description: "The tag name of image"
type: string
required: false
default: ''
GO_VERSION:
description: "Install the specify version of GO"
type: string
required: false
default: ''
GIT_CONFIG:
description: "InsteadOf git config global url (default: false)"
type: boolean
required: false
default: false
KUBECTL_VERSION:
description: "Install the specify version of kubectl (default: latest)"
type: string
required: false
default: 'v1.28.3'
REMOVE_PREFIX:
description: "Enable remove prefix v (default: true)"
type: boolean
required: false
default: true
env:
ACK_KUBECONFIG: ${{ secrets.ACK_KUBECONFIG }}
AKC_KUBECONFIG_55: ${{ secrets.ACK_KUBECONFIG_55 }}
GITHUB_USER: ${{ secrets.PERSONAL_ACCESS_USER }}
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
CONTROLLER_MANAGER_CFG: ${{ secrets.CONTROLLER_MANAGER_CFG }}
OPENCONSOLE_CFG: ${{ secrets.OPENCONSOLE_CFG }}
DOCKER_REGISTRY_USER: ${{ secrets.DOCKER_REGISTRY_USER }}
DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
jobs:
deploy-aliyun-ack:
permissions:
contents: 'read'
id-token: 'write'
runs-on: ubuntu-latest
outputs:
tag-name: ${{ steps.get_tag_name.outputs.TAG-NAME }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Go specify version
if: inputs.GO_VERSION
uses: actions/setup-go@v3
with:
go-version: ${{ inputs.GO_VERSION }}
- uses: azure/setup-kubectl@v3
with:
version: "${{ inputs.KUBECTL_VERSION }}"
- name: git config
if: inputs.GIT_CONFIG
run: |
git config --global url."https://${{ env.GITHUB_USER }}:${{ env.GITHUB_TOKEN }}@github.com".insteadof "https://github.com"
- name: remove v prefix
id: get_tag_name
shell: bash
run: |
tag_name="${{ inputs.VERSION }}"
if [[ "$tag_name" == "v"* && "${{ inputs.REMOVE_PREFIX }}" == "true" ]]; then
tag_name="${tag_name/v/}"
fi
echo TAG-NAME=$tag_name >> $GITHUB_OUTPUT
- if: ${{ env.ACK_KUBECONFIG != '' }}
name: Configure ACK Context
run: |
mkdir -p $HOME/.kube
touch $HOME/.kube/config
echo "${{ env.ACK_KUBECONFIG }}" > $HOME/.kube/config
- if: ${{ env.ACK_KUBECONFIG != '' }}
name: Configure ACK Context
run: |
kubectl get pod -A
# - if: ${{ env.ACK_KUBECONFIG_55 != '' && inputs.REGION == 'beilian' }}
# name: Configure ACK Context 55
# run: |
# mkdir -p $HOME/.kube
# touch $HOME/.kube/config
# echo "${{ env.ACK_KUBECONFIG_55 }}" > $HOME/.kube/config
#
# - name: make pre
# if: inputs.MAKE_OPS_PRE
# run: |
# make ${{ inputs.MAKE_OPS_PRE }}
#
# - if: ${{ (env.ACK_KUBECONFIG != '' || env.ACK_KUBECONFIG_55 != '') && inputs.REGION != '' }}
# name: deploy to aliyun ack
# run: |
# cmd="make ${{ inputs.MAKE_OPS }} "
#
# if [[ ! -z "${{ inputs.VERSION }}" ]]; then
# cmd=$cmd"VERSION=${{ steps.get_tag_name.outputs.TAG-NAME }} "
# fi
#
# eval "$cmd"