-
Notifications
You must be signed in to change notification settings - Fork 2
78 lines (67 loc) · 2.32 KB
/
deploy-openshift.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
name: Deploy to OpenShift
on:
pull_request:
paths:
- "src/**"
- ".github/workflows/**"
- "Makefile"
- "pyproject.toml"
- "poetry.lock"
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
environment: test-non-prod
env:
IMAGE_NAME: deep-thought
REGISTRY_URI: quay.io
OPENSHIFT_PROJECT_NAME: deep-thought-github
steps:
# - name: Checkout repository
# uses: actions/checkout@v2
# - name: Login to OpenShift
# uses: redhat-actions/oc-login@v1
# with:
# openshift_server_url: ${{ secrets.OPENSHIFT_SERVER_URL }}
# openshift_token: ${{ secrets.OPENSHIFT_API_TOKEN }}
# insecure_skip_tls_verify: true
# namespace: ${{ secrets.OPENSHIFT_PROJECT_NAME }}
# - name: Build container image
# uses: redhat-actions/buildah-build@v2
# with:
# image: ${{ env.IMAGE_NAME }}
# tags: latest ${{ github.sha }}
# dockerfiles: |
# ./Dockerfile
# - name: Push To Quay Registry
# uses: redhat-actions/push-to-registry@v2
# with:
# image: ${{ env.IMAGE_NAME }}
# tags: latest
# registry: quay.io/${{ secrets.QUAY_REPOSITORY }}
# username: ${{ secrets.QUAY_USERNAME }}
# password: ${{ secrets.QUAY_PASSWORD }}
# - name: Deploy to OpenShift
# run: |
# oc new-app quay.io/${{ secrets.QUAY_REPOSITORY }}/${{ env.IMAGE_NAME }}:latest
# oc expose svc/${{ env.IMAGE_NAME }}
# oc rollout status deployment/${{ env.IMAGE_NAME }}
# - name: Verify Deployment
# run: |
# oc get pods -n ${{ secrets.OPENSHIFT_PROJECT_NAME }}
- name: Checkout repository
uses: actions/checkout@v2
- name: Login to OpenShift
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER_URL }}
openshift_token: ${{ secrets.OPENSHIFT_API_TOKEN }}
insecure_skip_tls_verify: true
namespace: ${{ secrets.OPENSHIFT_PROJECT_NAME }}
- name: Trigger OpenShift Build
run: oc start-build <build-config-name> --follow --wait
- name: Verify Deployment
run: |
oc get pods -n ${{ secrets.OPENSHIFT_PROJECT_NAME }}