-
Notifications
You must be signed in to change notification settings - Fork 32
/
Jenkinsfile
89 lines (83 loc) · 3.48 KB
/
Jenkinsfile
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
def secrets = [
[path: params.VAULT_PATH_SVC_ACCOUNT_EPHEMERAL, secretValues: [
[envVar: 'OC_LOGIN_TOKEN_DEV', vaultKey: 'oc-login-token-dev'],
[envVar: 'OC_LOGIN_SERVER_DEV', vaultKey: 'oc-login-server-dev'],
[envVar: 'OC_LOGIN_TOKEN', vaultKey: 'oc-login-token'],
[envVar: 'OC_LOGIN_SERVER', vaultKey: 'oc-login-server']]],
[path: params.VAULT_PATH_QUAY_PUSH, secretValues: [
[envVar: 'QUAY_USER', vaultKey: 'user'],
[envVar: 'QUAY_TOKEN', vaultKey: 'token']]],
[path: params.VAULT_PATH_INSIGHTSDROID_GITHUB, secretValues: [
[envVar: 'GITHUB_TOKEN', vaultKey: 'token'],
[envVar: 'GITHUB_API_URL', vaultKey: 'mirror_url']]],
[path: params.VAULT_PATH_RHR_PULL, secretValues: [
[envVar: 'RH_REGISTRY_USER', vaultKey: 'user'],
[envVar: 'RH_REGISTRY_TOKEN', vaultKey: 'token']]]
]
def configuration = [vaultUrl: params.VAULT_ADDRESS, vaultCredentialId: params.VAULT_CREDS_ID]
pipeline {
agent { label 'rhel8' }
options {
timestamps()
parallelsAlwaysFailFast()
}
environment {
APP_NAME="compliance"
ARTIFACTS_DIR=""
CICD_URL="https://raw.githubusercontent.com/RedHatInsights/cicd-tools/main"
COMPONENT_NAME="compliance"
IMAGE="quay.io/cloudservices/compliance-backend"
IQE_CJI_TIMEOUT="30m"
IQE_FILTER_EXPRESSION=""
IQE_MARKER_EXPRESSION="compliance_smoke"
IQE_PLUGINS="compliance"
REF_ENV="insights-stage"
}
stages {
stage('Build the PR commit image') {
steps {
withVault([configuration: configuration, vaultSecrets: secrets]) {
sh 'bash -x build_deploy.sh'
}
}
}
stage('Run Tests') {
parallel {
stage('Run unit tests') {
steps {
withVault([configuration: configuration, vaultSecrets: secrets]) {
sh 'bash -x ./scripts/unit_test.sh'
}
}
}
stage('Run smoke tests') {
steps {
withVault([configuration: configuration, vaultSecrets: secrets]) {
sh '''
AVAILABLE_CLUSTERS=('ephemeral' 'crcd')
curl -s ${CICD_URL}/bootstrap.sh > .cicd_bootstrap.sh
source ./.cicd_bootstrap.sh
source "${CICD_ROOT}/deploy_ephemeral_env.sh"
source "${CICD_ROOT}/cji_smoke_test.sh"
'''
}
}
post {
failure {
slackSend channel: '@eshamard', color: "danger", message: "Smoke tests failed in Compliance PR check. <${env.ghprbPullLink}|PR link> (<${env.BUILD_URL}|Build>)"
}
unstable {
slackSend channel: '@eshamard', color: "warning", message: "Smoke tests failed in Compliance PR check. <${env.ghprbPullLink}|PR link> (<${env.BUILD_URL}|Build>)"
}
}
}
}
}
}
post {
always{
archiveArtifacts artifacts: 'artifacts/**/*', fingerprint: true
junit skipPublishingChecks: true, testResults: 'artifacts/junit-*.xml'
}
}
}