ECS-447 Update publication.yml #177
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR-CYCLE | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
branches: | |
- develop | |
- epic/* | |
- release/* | |
env: | |
ENTANDO_OPT_USE_PPL_TAG: "v1.3.0" | |
ENTANDO_OPT_ENVIRONMENTS: "${{ secrets.ENTANDO_OPT_ENVIRONMENTS }}" | |
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_REPO_BOM_URL: "${{ secrets.ENTANDO_OPT_REPO_BOM_URL }}" | |
ENTANDO_OPT_CUSTOM_ENV: "${{ secrets.ENTANDO_OPT_CUSTOM_ENV }}" | |
ENTANDO_OPT_OKD_LOGIN: "${{ secrets.ENTANDO_OPT_OKD_LOGIN }}" | |
ENTANDO_OPT_IMAGE_REGISTRY_OVERRIDE: "${{ secrets.ENTANDO_OPT_IMAGE_REGISTRY_OVERRIDE }}" | |
ENTANDO_OPT_DOCKER_ORG: "${{ secrets.ENTANDO_OPT_DOCKER_ORG }}" | |
ENTANDO_OPT_TEST_NAMESPACE: "${{ secrets.ENTANDO_OPT_TEST_NAMESPACE }}" | |
ENTANDO_OPT_HELM_CLI_URL: "${{ secrets.ENTANDO_OPT_HELM_CLI_URL }}" | |
ENTANDO_OPT_TEST_POSTDEP_PLAN: "${{ secrets.ENTANDO_OPT_TEST_POSTDEP_PLAN }}" | |
ENTANDO_OPT_TEST_COMPOSE_FILE: "${{ secrets.ENTANDO_OPT_TEST_COMPOSE_FILE }}" | |
ENTANDO_OPT_TEST_OPERATOR_BUNDLE_URL: "${{ secrets.ENTANDO_OPT_TEST_OPERATOR_BUNDLE_URL }}" | |
ENTANDO_OPT_TEST_OPERATOR_BUNDLE_VERSION: "${{ secrets.ENTANDO_OPT_TEST_OPERATOR_BUNDLE_VERSION }}" | |
PPL_CONTEXT: ${{ toJson(github) }} | |
GIT_USER_NAME: "${{ secrets.GIT_USER_NAME }}" | |
GIT_USER_EMAIL: "${{ secrets.GIT_USER_EMAIL }}" | |
LOCAL_CLONE_DIR: "local-checkout" | |
ENTANDO_OPT_SNYK_ORG: "${{ secrets.ENTANDO_OPT_SNYK_ORG }}" | |
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 \ | |
.. status-report \ | |
.. @checkout-branch --lcd "$LOCAL_CLONE_DIR" \ | |
.. @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_URL: "${{ secrets.ENTANDO_OPT_OKD_LOGIN_URL }}" | |
ENTANDO_OPT_OKD_LOGIN_TOKEN: "${{ secrets.ENTANDO_OPT_OKD_LOGIN_TOKEN }}" | |
ENTANDO_OPT_OKD_LOGIN_NAMESPACE: "${{ secrets.ENTANDO_OPT_OKD_LOGIN_NAMESPACE }}" | |
ENTANDO_OPT_OKD_LOGIN_INSECURE: "${{ secrets.ENTANDO_OPT_OKD_LOGIN_INSECURE }}" | |
ENTANDO_OPT_OKD_CLI_URL: "${{ secrets.ENTANDO_OPT_OKD_CLI_URL }}" | |
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" \ | |
; | |
~/ppl-run generic GENERATE-BUILD-CACHE-KEY "BUILD_CACHE_KEY" --lcd "$LOCAL_CLONE_DIR" >> $GITHUB_ENV | |
#~ JDK | |
- name: "Set up JDK 11" | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
#~ MAVEN CACHE | |
- name: "Cache Maven packages" | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2 | |
restore-keys: ${{ runner.os }}-m2 | |
#~ BUILD CACHE | |
- name: "Cache Build Dir" | |
id: build-cache | |
uses: actions/cache@v2 | |
with: | |
path: "${{ env.LOCAL_CLONE_DIR }}/target/" | |
key: ${{ runner.os }}-build-${{ env.BUILD_CACHE_KEY }} | |
#~ 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" | |
~/ppl-run generic GENERATE-BUILD-CACHE-KEY "BUILD_CACHE_KEY" --lcd "$LOCAL_CLONE_DIR" >> $GITHUB_ENV | |
#~ JDK | |
- name: "Set up JDK 11" | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
#~ 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- | |
#~ BUILD CACHE | |
- name: "Cache Build Dir" | |
id: build-cache | |
uses: actions/cache@v2 | |
with: | |
path: "${{ env.LOCAL_CLONE_DIR}}/target/" | |
key: ${{ runner.os }}-build-${{ env.BUILD_CACHE_KEY }} | |
#~ 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" |