-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
81 lines (72 loc) · 2.65 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
pipeline {
agent { docker { image 'mcr.microsoft.com/playwright:v1.49.1-noble' } }
environment {
HOME = '.'
CORE_PORTAL_DEPLOYMENTS_REPO = '[email protected]:TACC/Core-Portal-Deployments.git'
}
stages {
stage('Checkout Core Portal Deployments Code') {
steps {
script {
// Clone Core Portal Deployments repo into a subdirectory
dir('core-portal-deployments') {
git branch: 'main',
credentialsId: "wma-portals-github",
url: "${CORE_PORTAL_DEPLOYMENTS_REPO}"
}
}
}
}
stage('Read and transform portal config file') {
steps {
script {
// Displaying the contents of the current directory and the config directory
sh "ls -l"
sh "ls -l core-portal-deployments/${params.Portal}/camino"
// Copying the portal configuration file to the local workspace
def sourceFilePath = "core-portal-deployments/${params.Portal}/camino"
def destinationFilePath = 'settings'
sh "cp ${sourceFilePath}/${params.Environment}.settings_custom.py ${destinationFilePath}/custom_portal_settings.py"
sh "cp ${sourceFilePath}/${params.Environment}.env ${destinationFilePath}/.env.portal"
// Running a Python script to process and output the portal settings as JSON
sh "python3 utils/pythonHelper.py"
echo "Using the following portal settings:"
sh "cat settings/custom_portal_settings.json"
sh "cat settings/.env.portal"
}
}
}
stage('install playwright') {
steps {
sh 'npm i -D @playwright/test'
sh 'npx playwright install'
}
}
stage('e2e-tests') {
steps {
withCredentials([usernamePassword(credentialsId: 'portal_tests_user', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
sh 'npx playwright test --list'
sh 'USERNAME=$USERNAME PASSWORD=$PASSWORD npx playwright test'
}
}
}
}
post {
always {
publishHTML([
allowMissing: true,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'playwright-report',
reportFiles: 'index.html',
reportName: 'Playwright Test Report',
reportTitles: ''
])
junit(
allowEmptyResults: true,
testResults: 'playwright-report/results.xml'
)
cleanWs()
}
}
}