-
Notifications
You must be signed in to change notification settings - Fork 1
159 lines (151 loc) · 5.81 KB
/
pr.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
name: PR-CYCLE
on:
pull_request:
types:
- opened
- synchronize
- reopened
branches:
- develop
- epic/*
- release/*
env:
ENTANDO_OPT_USE_PPL_TAG: "v1.4.2"
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:
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# PREPARE
prepare:
runs-on: ubuntu-latest
outputs:
SCAN_MATRIX: ${{ steps.START.outputs.SCAN_MATRIX }}
steps:
#~
- name: "PR PIPELINE START"
id: START
run: |
${{ secrets.ENTANDO_OPT_PPL_INSTALL_CMD }}
~/ppl-run \
.. @checkout-branch --lcd "$LOCAL_CLONE_DIR" \
.. status-report \
.. @setup-feature-flags "PR_PREFLIGHT_CHECKS" "BOM_CHECK" "BOM" \
.. @setup-features-list "SCAN_MATRIX" --prefix "MTX-MVN-,MTX-SCAN-" \
;
- name: "PR preflight checks"
if: steps.START.outputs.PR_PREFLIGHT_CHECKS != 'false'
id: pr-preflight-checks
run: |
~/ppl-run pr-preflight-checks --lcd "$LOCAL_CLONE_DIR"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# FULL-BUILD
full-build:
needs: [ 'prepare' ]
runs-on: ubuntu-latest
env:
ENTANDO_BOT_TOKEN: "${{ secrets.ENTANDO_BOT_TOKEN }}"
ENTANDO_OPT_OKD_LOGIN_TOKEN: "${{ secrets.ENTANDO_OPT_OKD_LOGIN_TOKEN }}"
steps:
#~ CHECKOUT
- name: "CHECKOUT"
id: CHECKOUT
run: |
${{ secrets.ENTANDO_OPT_PPL_INSTALL_CMD }}
~/ppl-run checkout-branch \
--lcd "$LOCAL_CLONE_DIR" \
--token "$ENTANDO_BOT_TOKEN" \
;
#~ 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
#~ SONAR CACHE
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
#~ BUILD
- name: "FULL BUILD"
env:
ENTANDO_OPT_SONAR_PROJECT_KEY: "${{ secrets.ENTANDO_OPT_SONAR_PROJECT_KEY }}"
SONAR_TOKEN: "${{ secrets.SONAR_TOKEN }}"
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
~/ppl-run generic FULL-BUILD --lcd "$LOCAL_CLONE_DIR"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# SCANS
# scans:
# needs: [ 'prepare', 'full-build' ]
# runs-on: ubuntu-latest
# if: ${{ needs.prepare.outputs.SCAN_MATRIX != '' }}
# strategy:
# max-parallel: 5
# fail-fast: false
# matrix:
# scan-type: ${{fromJson(needs.prepare.outputs.SCAN_MATRIX)}}
#
# steps:
# #~ CHECKOUT
# - name: "CHECKOUT"
# run: |
# ${{ secrets.ENTANDO_OPT_PPL_INSTALL_CMD }}
# ~/ppl-run checkout-branch pr --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"
# id: maven-cache
# uses: actions/cache@v2
# with:
# path: ~/.m2
# key: ${{ runner.os }}-m2-matrix-${{ matrix.scan-type }}
# restore-keys: |
# ${{ runner.os }}-m2-matrix-${{ matrix.scan-type }}
# ${{ runner.os }}-m2-matrix-
# ${{ runner.os }}-m2-
# #~ SCAN
# - name: "Run the matrix step ${{ matrix.scan-type }}"
# run: |
# SCAN_TYPE="${{ matrix.scan-type }}"
# case "$SCAN_TYPE" in
# MTX-MVN-SCAN-SONAR)
# export GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}"
# export SONAR_TOKEN="${{ secrets.SONAR_TOKEN }}"
# export ENTANDO_OPT_SONAR_PROJECT_KEY="${{ secrets.ENTANDO_OPT_SONAR_PROJECT_KEY }}"
# ;;
# MTX-SCAN-SNYK)
# export SNYK_TOKEN="${{ secrets.SNYK_TOKEN }}"
# ;;
# MTX-MVN-POST-DEPLOYMENT-TESTS)
# 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 }}"
# ;;
# esac
# ~/ppl-run generic "$SCAN_TYPE" mvn --id "$SCAN_TYPE" --lcd "$LOCAL_CLONE_DIR"