-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (65 loc) · 2.77 KB
/
edu-s3-trigger-cronjob.yml
File metadata and controls
79 lines (65 loc) · 2.77 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
---
name: EDU Trigger Cronjob
on:
workflow_call:
inputs:
CLUSTER:
required: true
type: string
NAMESPACE:
required: true
type: string
BUCKET:
required: true
type: string
KUBERNETES_VERSION:
required: true
type: string
secrets:
KUBECONFIG:
required: true
jobs:
run_kubectl_commands_edusharing:
environment: ${{ inputs.CLUSTER }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
path: "repo/infra-deploy"
repository: hpi-schul-cloud/infra-deploy
- name: Create Kubeconfig file
working-directory: ${{ github.workspace }}/
run: |
echo "${{ secrets.KUBECONFIG }}" > kubeconfig
- name: Install Kubectl
working-directory: ${{ github.workspace }}/
run: |
curl -LO https://dl.k8s.io/release/v${{ inputs.KUBERNETES_VERSION }}/bin/linux/amd64/kubectl
chmod +x kubectl
mv ./kubectl /usr/local/bin/kubectl
- name: Kubernetes Delete previous Job - H5P
if: inputs.BUCKET == 'h5p'
working-directory: ${{ github.workspace }}
run: kubectl delete job h5p-s3-sync-cronjob-s3-sync-via-infra-deploy -n s3-sync --kubeconfig ${{ github.workspace }}/kubeconfig
continue-on-error: true
- name: Kubernetes Delete previous Job - FWU
if: inputs.BUCKET == 'fwu'
working-directory: ${{ github.workspace }}
run: kubectl delete job fwu-s3-sync-cronjob-s3-sync-via-infra-deploy -n s3-sync --kubeconfig ${{ github.workspace }}/kubeconfig
continue-on-error: true
# The Jobs can only get started, since the underlining Cronjob is already inside the Kubernetes Cluster. The Cronjob is managed via the infra-schulcloud repository.
- name: Kubernetes Create Sync Job - H5P
if: inputs.BUCKET == 'h5p'
working-directory: ${{ github.workspace }}
run: kubectl create job --from=cronjob/h5p-s3-sync-cronjob-s3-sync h5p-s3-sync-cronjob-s3-sync-via-infra-deploy -n s3-sync --kubeconfig ${{ github.workspace }}/kubeconfig
# The Jobs can only get started, since the underlining Cronjob is already inside the Kubernetes Cluster. The Cronjob is managed via the infra-schulcloud repository.
- name: Kubernetes Create Sync Job - FWU
if: inputs.BUCKET == 'fwu'
working-directory: ${{ github.workspace }}
run: kubectl create job --from=cronjob/fwu-s3-sync-cronjob-s3-sync fwu-s3-sync-cronjob-s3-sync-via-infra-deploy -n s3-sync --kubeconfig ${{ github.workspace }}/kubeconfig
- name: Delete kubeconfig files
if: always()
working-directory: ${{ github.workspace }}
run: |
rm -f kubeconfig