-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (67 loc) · 2.32 KB
/
scripting.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
name: scripting
on:
workflow_dispatch:
inputs:
context:
type: string
description: nullplatform service lifecycle webhook context
required: true
permissions:
id-token: write
contents: read
packages: read
jobs:
provisioning:
runs-on: self-hosted
env:
NP_ACTION_CONTEXT: ${{ inputs.context }}
steps:
- name: Install nullplatform cli
run: echo $DOCKER_PASSWORD | sudo -S curl https://cli.nullplatform.com/install.sh | sudo -S sh
- name: Checkout code
uses: actions/checkout@v4
id: checkout-code
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install Gomplate
run: npm install -g gomplate
- name: Install Kubectl
uses: azure/setup-kubectl@v4
with:
version: 'v1.30.2'
id: install
- name: Prepare event data
uses: actions/github-script@v7
id: prepare-event-data
with:
script: |
const prepare = require('./.github/workflows/scripts/prepare-script.js');
prepare({ core });
- name: Log Script
run: echo $SCRIPT_PATH
- name: Install oc
uses: redhat-actions/oc-installer@v1
with:
oc_version: '4.6'
- name: Execute Script
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ vars.REGION }}
NP_API_KEY: ${{ secrets.NP_API_KEY }}
OPENSHIFT_ROSA_SERVER: ${{ vars.OPENSHIFT_ROSA_SERVER }}
OPENSHIFT_ROSA_SECRET: ${{ secrets.OPENSHIFT_ROSA_SECRET }}
run: source $SCRIPT_PATH
- name: Update entity status
if: ${{ always() }}
id: nullplatform-update-entity-status
env:
NULLPLATFORM_API_KEY: ${{ secrets.NULLPLATFORM_API_KEY }}
run: |
if [[ $LINK_ID ]]; then
np link action update --status ${{ contains(fromJSON('["failure", "cancelled"]'), job.status) && 'failed' || 'success' }} --messages '[]' --results '{}'
elif [[ $SERVICE_ID ]]; then
np service action update --status ${{ contains(fromJSON('["failure", "cancelled"]'), job.status) && 'failed' || 'success' }} --messages '[]' --results '{}'
fi