-
Notifications
You must be signed in to change notification settings - Fork 1
180 lines (169 loc) · 6.63 KB
/
publication.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: PUB
on:
push:
tags:
- 'v*'
env:
ENTANDO_OPT_USE_PPL_TAG: "v1.4.1"
ENTANDO_OPT_DATA_REPO: "${{ secrets.ENTANDO_OPT_DATA_REPO }}"
ENTANDO_OPT_DATA_REPO_TOKEN: "${{ secrets.ENTANDO_OPT_DATA_REPO_TOKEN }}"
ENTANDO_OPT_ENVIRONMENT_NAMES: "${{ secrets.ENTANDO_OPT_ENVIRONMENT_NAMES }}"
ENTANDO_OPT_FEATURES: "${{ secrets.ENTANDO_OPT_FEATURES }}"
ENTANDO_OPT_GLOBAL_FEATURES: "${{ secrets.ENTANDO_OPT_GLOBAL_FEATURES }}"
ENTANDO_OPT_LOG_LEVEL: "${{ secrets.ENTANDO_OPT_LOG_LEVEL }}"
ENTANDO_OPT_CUSTOM_ENV: "${{ secrets.ENTANDO_OPT_CUSTOM_ENV }}"
PPL_CONTEXT: ${{ toJson(github) }}
LOCAL_CLONE_DIR: "local-checkout"
jobs:
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# PUBLICATION
publication:
outputs:
POST_PUB_DOCKER_SCAN: ${{ steps.START.outputs.POST_PUB_DOCKER_SCAN }}
POST_DEP_TESTS: ${{ steps.START.outputs.POST_DEP_TESTS }}
env:
ENTANDO_BOT_TOKEN: ${{ secrets.ENTANDO_BOT_TOKEN }}
runs-on: ubuntu-latest
steps:
- name: "PR PIPELINE START"
id: START
run: |
${{ secrets.ENTANDO_OPT_PPL_INSTALL_CMD }}
~/ppl-run \
.. status-report \
.. @setup-feature-flags "PR_FORMAT_CHECK" "BOM_CHECK" "BOM" "POST_PUB_DOCKER_SCAN" "POST_DEP_TESTS" \
;
#~ CHECKOUT
- name: "CHECKOUT"
id: CHECKOUT
run: |
~/ppl-run \
.. checkout-branch --id "CHECKOUT FOR PUBLICATION" \
--lcd "$LOCAL_CLONE_DIR" \
--token "$ENTANDO_BOT_TOKEN" \
.. pr-preflight-checks --only flags --lcd "$LOCAL_CLONE_DIR" \
;
#~ JDK
- name: "Set up JDK 17"
uses: actions/setup-java@v1
with:
java-version: 17
#~ MAVEN CACHE
- name: "Cache Maven packages"
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2
restore-keys: ${{ runner.os }}-m2
#~ CONFIGURE REPO
- name: "Configure Entando Nexus Repository"
uses: actions/setup-java@v1
with:
java-version: 17
server-id: internal-nexus
server-username: NEXUS_USERNAME
server-password: NEXUS_PASSWORD
#~ PUBLISH THE ARTIFACT
- name: "Publish package"
run: |
~/ppl-run generic PUBLISH --id "PUBLICATION" \
--lcd "$LOCAL_CLONE_DIR"
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
#~ UPDATE THE BOM (if required)
- name: "BOM Update"
if: steps.CHECKOUT.outputs.BOM_UPDATE_FLAG == 'true' && steps.START.outputs.BOM == 'true'
run: |
~/ppl-run bom update-bom \
--id "UPDATE-BOM" \
--lcd "$LOCAL_CLONE_DIR" \
--token "$ENTANDO_BOT_TOKEN" \
;
#~ PUBLISH TO DOCKER
- name: "Publish docker"
run: |
export ENTANDO_OPT_DOCKER_PASSWORD="${{ secrets.ENTANDO_OPT_DOCKER_PASSWORD }}"
export ENTANDO_OPT_DOCKER_ALT_LOGIN_URL="${{ secrets.ENTANDO_OPT_DOCKER_ALT_LOGIN }}"
export ENTANDO_OPT_DOCKER_ALT_USERNAME="${{ secrets.ENTANDO_OPT_DOCKER_ALT_USERNAME }}"
export ENTANDO_OPT_DOCKER_ALT_PASSWORD="${{ secrets.ENTANDO_OPT_DOCKER_ALT_PASSWORD }}"
~/ppl-run docker publish --id "PUBLISH-DOCKER" --lcd "$LOCAL_CLONE_DIR"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# POST PUB JOBS
post-pub-docker-scan:
needs: [ 'publication' ]
if: needs.publication.outputs.POST_PUB_DOCKER_SCAN == 'true'
runs-on: ubuntu-latest
steps:
#~ CHECKOUT
- name: "CHECKOUT"
id: CHECKOUT
run: |
${{ secrets.ENTANDO_OPT_PPL_INSTALL_CMD }}
~/ppl-run \
.. checkout-branch --id "CHECKOUT FOR PUBLICATION" \
--lcd "$LOCAL_CLONE_DIR" \
--token "$ENTANDO_BOT_TOKEN" \
.. pr-preflight-checks --only flags --lcd "$LOCAL_CLONE_DIR" \
;
#~ JDK
- name: "Set up JDK 17"
uses: actions/setup-java@v1
with:
java-version: 17
#~ MAVEN CACHE
- name: "Cache Maven packages"
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2
restore-keys: ${{ runner.os }}-m2
#~ SCAN
- name: "Scan docker"
env:
ENTANDO_OPT_SNYK_ORG: "${{ secrets.ENTANDO_OPT_SNYK_ORG }}"
SNYK_TOKEN: "${{ secrets.SNYK_TOKEN }}"
ENTANDO_OPT_DOCKER_BUILDS: "${{ secrets.ENTANDO_OPT_DOCKER_BUILDS }}"
ENTANDO_OPT_DOCKER_ORG: "${{ secrets.ENTANDO_OPT_DOCKER_ORG }}"
run: |
~/ppl-run docker scan --id "SCAN-DOCKER" --lcd "$LOCAL_CLONE_DIR"
post-dep-tests:
needs: [ 'publication' ]
if: needs.publication.outputs.POST_DEP_TESTS == 'true'
runs-on: ubuntu-latest
steps:
#~ CHECKOUT
- name: "CHECKOUT"
id: CHECKOUT
run: |
${{ secrets.ENTANDO_OPT_PPL_INSTALL_CMD }}
~/ppl-run \
.. checkout-branch --id "CHECKOUT FOR PUBLICATION" \
--lcd "$LOCAL_CLONE_DIR" \
--token "$ENTANDO_BOT_TOKEN" \
.. pr-preflight-checks --only flags --lcd "$LOCAL_CLONE_DIR" \
;
#~ JDK
- name: "Set up JDK 17"
uses: actions/setup-java@v1
with:
java-version: 17
#~ MAVEN CACHE
- name: "Cache Maven packages"
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2
restore-keys: ${{ runner.os }}-m2
- name: "Post deployment tests"
run: |
${{ secrets.ENTANDO_OPT_PPL_INSTALL_CMD }}
export ENTANDO_OPT_OKD_LOGIN_TOKEN="${{ secrets.ENTANDO_OPT_OKD_LOGIN_TOKEN }}"
export ENTANDO_OPT_IMAGE_REGISTRY_CREDENTIALS="${{ secrets.ENTANDO_OPT_IMAGE_REGISTRY_CREDENTIALS }}"
export ENTANDO_OPT_DOCKER_USERNAME="${{ secrets.ENTANDO_OPT_DOCKER_USERNAME }}"
export ENTANDO_OPT_DOCKER_PASSWORD="${{ secrets.ENTANDO_OPT_DOCKER_PASSWORD }}"
export ENTANDO_OPT_TEST_TLS_CRT="${{ secrets.ENTANDO_OPT_TEST_TLS_CRT }}"
export ENTANDO_OPT_TEST_TLS_KEY="${{ secrets.ENTANDO_OPT_TEST_TLS_KEY }}"
~/ppl-run generic "POST-DEP-TESTS" --id "POST_DEP_TESTS" --lcd "$LOCAL_CLONE_DIR"