-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (95 loc) · 3.26 KB
/
manual-deploy.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
name: Deploy shiny app
on:
workflow_dispatch:
inputs:
name:
description: "Nom du chart à déployer"
type: string
required: true
default: test
username:
description: Onyxia username
type: string
required: true
default: ananda
refreshToken:
description: Refresh token"
type: string
required: true
jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: yq - portable yaml processor
uses: mikefarah/[email protected]
- name: Set image name
run: echo "IMAGE_NAME=$(yq '.shiny.image.repository' ./charts/values.yaml)" >> $GITHUB_ENV
- name: Image name
run: |
echo ${{ env.IMAGE_NAME }}
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v3
with:
images: ${{ env.IMAGE_NAME }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./app/
file: ./app/Dockerfile
push: true
tags: ${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
deploy:
needs: docker
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.environment_name }}
steps:
- name: Mask token
run: |
REFRESH_TOKEN=$(jq -r '.inputs.refreshToken' $GITHUB_EVENT_PATH)
echo ::add-mask::$REFRESH_TOKEN
echo REFRESH_TOKEN=$REFRESH_TOKEN >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- uses: azure/setup-kubectl@v3
with:
version: 'v1.29.1'
id: install_kubectl
- uses: azure/[email protected]
with:
version: '3.14.4'
id: install_helm
- name: Set credentials
run : |
kubectl config set-cluster apiserver.kub.sspcloud.fr \
--server=https://apiserver.kub.sspcloud.fr \
--insecure-skip-tls-verify=true
kubectl config set-credentials${{ github.event.inputs.username }} \
--auth-provider=oidc \
--auth-provider-arg=idp-issuer-url=https://auth.lab.sspcloud.fr/auth/realms/sspcloud \
--auth-provider-arg=client-id=onyxia \
--auth-provider-arg=refresh-token=${{ env.REFRESH_TOKEN }}
kubectl config set-context apiserver.kub.sspcloud.fr \
--user=${{ github.event.inputs.username }} \
--cluster=apiserver.kub.sspcloud.fr \
--namespace=user-${{ github.event.inputs.username }}
kubectl config use-context apiserver.kub.sspcloud.fr
- name: "Deploy helm charts"
run : |
helm dependency update ./charts
helm upgrade ${{ github.event.inputs.name }} ./charts --recreate-pods --install