-
Notifications
You must be signed in to change notification settings - Fork 14
117 lines (93 loc) · 3.73 KB
/
org_example.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
name: Install into redhat-actions
on:
push:
workflow_dispatch:
schedule:
# nightly 10pm. note this workflow cleans up after itself
- cron: "0 22 * * *"
jobs:
install-org-runner:
runs-on: ubuntu-20.04
name: Install runner into organization
outputs:
helm_release_name: ${{ steps.install-runners.outputs.helm_release_name }}
steps:
- name: Checkout action
uses: actions/checkout@v2
# Log into our K8s (openshift) cluster
- uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
namespace: ${{ secrets.OPENSHIFT_NAMESPACE }}
insecure_skip_tls_verify: true
# Install self-
- name: Install self hosted runner into org
id: install-runners
# uses: redhat-actions/openshift-actions-runner-installer@v1
# Test the checked-out version of this runner - a user would need the above 'uses'.
uses: ./
with:
# This token has 'repo' and 'admin:org' permissions
github_pat: ${{ secrets.ORG_TOKEN }}
# This runner will be added to the "redhat-actions" organization.
runner_location: redhat-actions
# Use this container image for the runner.
runner_image: quay.io/redhat-github-actions/java-runner-11
# Use this tag for the runner_image
runner_tag: v1
# Give the runner these labels (which are required by the workflow below)
runner_labels: openshift, java
# Create 2 replicas so we can run jobs in parallel
runner_replicas: 2
# Instruct the helm chart to use a custom secret name,
# so it doesn't conflict with the secret the repo example uses,
# and inject a custom environment variable into the containers.
helm_extra_args: |
--set-string secretName=github-org-pat
--set runnerEnv[0].name="MY_ENV_VAR" --set runnerEnv[0].value="my_env_value"
# Refer to the helm chart https://github.com/redhat-actions/openshift-actions-runner-chart
# for values you can override.
- name: Echo outputs
shell: bash
run: |
echo "${{ toJSON(steps.install-runners.outputs) }}"
test-org-selfhosted:
name: Self Hosted Quarkus Build and Test
runs-on: [ self-hosted, java ]
needs: install-org-runner
defaults:
run:
working-directory: getting-started
env:
WORKDIR: getting-started
steps:
- uses: actions/checkout@v2
with:
repository: redhat-actions/quarkus-quickstarts
- run: java --version
# https://github.com/redhat-actions/quarkus-quickstarts/tree/master/getting-started#readme
# Build, test, and upload our executable jars.
- run: ./mvnw install -ntp
working-directory: ${{ env.WORKDIR }}
- run: ./mvnw test
working-directory: ${{ env.WORKDIR }}
- uses: actions/upload-artifact@v2
with:
name: app-jar-files.zip
path: ${{ env.WORKDIR }}/target/*.jar
teardown-org-runner:
name: Tear down self-hosted runners
runs-on: ubuntu-20.04
needs: [ install-org-runner, test-org-selfhosted ]
if: needs.install-org-runner.outputs.helm_release_name != ''
steps:
- uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
namespace: ${{ secrets.OPENSHIFT_NAMESPACE }}
insecure_skip_tls_verify: true
- run: helm ls
- name: Clean up self-hosted runners
run: helm uninstall ${{ needs.install-org-runner.outputs.helm_release_name }}