Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RANCHER-1276 Cypress test fails during nightly run #456

Open
wants to merge 2 commits into
base: RANCHER-741-Jenkins-Enhancements
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,17 +1,15 @@
#!groovy
package folioRancher.folioScheduledTesting.runNightlyCypressBugfestTests


import org.jenkinsci.plugins.workflow.libs.Library

@Library('pipelines-shared-library@RANCHER-741-Jenkins-Enhancements') _
@Library('pipelines-shared-library@RANCHER-1276') _
//@Library('pipelines-shared-library@RANCHER-741-Jenkins-Enhancements') _

properties([
//pipelineTriggers([cron('H 0 * * 1-6')]),
//pipelineTriggers([cron('H 0 * * 1-6')]), //TODO Disabled by Mriya team request for BugFest period
buildDiscarder(logRotator(numToKeepStr: '30')),
disableConcurrentBuilds(),
parameters([
string(name: 'CYPRESS_BUGFEST_BRANCH', defaultValue: 'poppy', description: "(Required) Insert what 'stripes-testing' branch use for build"),
string(name: 'CYPRESS_BUGFEST_BRANCH', defaultValue: 'quesnelia', description: "(Required) Insert what 'stripes-testing' branch use for build"),
folioParameters.agent(),
folioParameters.refreshParameters()
])
Expand All @@ -25,26 +23,26 @@ if (params.REFRESH_PARAMETERS) {
Map cypressBugfestFlowParameters = [
customBuildName : env.JOB_BASE_NAME,
branch : params.CYPRESS_BUGFEST_BRANCH,
tenantUrl : "https://bugfest-poppy-aqa.int.aws.folio.org",
okapiUrl : "https://okapi-bugfest-poppy-aqa.int.aws.folio.org",
tenantUrl : "https://bugfest-quesnelia-aqa.int.aws.folio.org",
okapiUrl : "https://okapi-bugfest-quesnelia-aqa.int.aws.folio.org",
tenantId : 'fs09000003',
adminUsername : 'folio-aqa',
adminPassword : 'Folio-aqa1',
parallelExecParameters : '--env grepTags="smoke criticalPth extendedPath --nonParallel"',
sequentialExecParameters: '--env grepTags="smoke+nonParallel criticalPth+nonParallel extendedPath+nonParallel"',
testsTimeout : '10',
parallelExecParameters : '--env grepTags="smoke criticalPth extendedPath"',
// sequentialExecParameters: '--env grepTags="smoke+nonParallel criticalPth+nonParallel extendedPath+nonParallel"',
testsTimeout : '14',
testrailProjectID : '14',
testrailRunID : '2307',
numberOfWorkers : '10',
agent : 'rancher||jenkins-agent-java17',
testrailRunID : '2421',
numberOfWorkers : '6',
agent : 'cypress-static',
useReportPortal : 'false'
]

ansiColor('xterm') {
node(params.AGENT) {
stage('Ini') {
buildName env.BUILD_ID
buildDescription ""
buildDescription "Branch: ${params.CYPRESS_BUGFEST_BRANCH}\nEnv: ${cypressBugfestFlowParameters.tenantUrl}"
cleanWs()
}

Expand Down
Expand Up @@ -2,17 +2,18 @@
import org.folio.models.RancherNamespace
import org.jenkinsci.plugins.workflow.libs.Library

@Library('pipelines-shared-library@RANCHER-741-Jenkins-Enhancements') _
@Library('pipelines-shared-library@RANCHER-1276') _
//@Library('pipelines-shared-library@RANCHER-741-Jenkins-Enhancements') _

properties([
pipelineTriggers([cron('H 20 * * *')]),
buildDiscarder(logRotator(numToKeepStr: '30')),
disableConcurrentBuilds(),
parameters([
string(name: 'CYPRESS_BRANCH', defaultValue: 'master', description: "(Required) Insert what 'stripes-testing' branch use for build"),
folioParameters.agent(),
folioParameters.refreshParameters()
])
// pipelineTriggers([cron('H 20 * * *')]), //TODO Disabled by Mriya team request for BugFest period
buildDiscarder(logRotator(numToKeepStr: '30')),
disableConcurrentBuilds(),
parameters([
string(name: 'CYPRESS_BRANCH', defaultValue: 'master', description: "(Required) Insert what 'stripes-testing' branch use for build"),
folioParameters.agent(),
folioParameters.refreshParameters()
])
])

if (params.REFRESH_PARAMETERS) {
Expand All @@ -29,31 +30,32 @@ def ns
RancherNamespace namespace = new RancherNamespace('folio-testing', 'cypress')

Map cypressFlowParameters = [
customBuildName : env.JOB_BASE_NAME,
branch : params.CYPRESS_BRANCH,
tenantUrl : "https://${namespace.generateDomain('diku')}",
okapiUrl : "https://${namespace.generateDomain('okapi')}",
tenantId : 'diku',
adminUsername : 'diku_admin',
adminPassword : 'admin',
parallelExecParameters : '--env grepTags="smoke criticalPath --nonParallel"',
customBuildName : env.JOB_BASE_NAME,
branch : params.CYPRESS_BRANCH,
tenantUrl : "https://${namespace.generateDomain('diku')}",
okapiUrl : "https://${namespace.generateDomain('okapi')}",
tenantId : 'diku',
adminUsername : 'diku_admin',
adminPassword : 'admin',
parallelExecParameters: '--env grepTags="smoke"',
// parallelExecParameters: '--env grepTags="smoke criticalPath"',
// sequentialExecParameters: '--env grepTags="smoke+nonParallel criticalPath+nonParallel"',
testsTimeout : '14',
testrailProjectID : '14',
testrailRunID : '2108',
numberOfWorkers : '10',
agent : 'rancher',
useReportPortal : 'true'
// sequentialExecParameters: '--env grepTags="smoke"',
testsTimeout : '8',
// testrailProjectID : '14',
// testrailRunID : '2108',
numberOfWorkers : '4', //Changed form 10 to 6 according to instance resources capacity
agent : 'cypress-static',
useReportPortal : 'false'
]

ansiColor('xterm') {
node(params.AGENT) {
stage('Ini') {
buildName env.BUILD_ID
buildDescription ""
buildDescription "Branch: ${params.CYPRESS_BRANCH}\nEnv: ${cypressFlowParameters.tenantUrl}"
cleanWs()
}

stage('[Job] Destroy environment') {
script {
folioHelm.withKubeConfig(namespace.getClusterName()) {
Expand All @@ -62,7 +64,6 @@ ansiColor('xterm') {
if (ns == namespace.namespaceName) {
build job: deleteNamespaceJobName,
parameters: _defaultEnvironmentParameters(namespace.getClusterName(), namespace.getNamespaceName())
println("${ns}")
} else {
println(namespace.namespaceName + ' namespace does not exists!')
}
Expand All @@ -83,13 +84,12 @@ ansiColor('xterm') {
booleanParam(name: 'GREENMAIL', value: false),
string(name: 'MEMBERS', value: '')]
} catch (Exception new_ex) {
slackSend(attachments: folioSlackNotificationUtils.renderFailedBuildResultMessage()
, channel: "#rancher_tests_notifications")
slackSend(attachments: folioSlackNotificationUtils.renderSlackFailedResultMessage()
, channel: "#rancher_tests_notifications")
throw new Exception("Provision of the environment is failed: " + new_ex)
}
}
}

stage('[Flow] Execute tests') {
folioCypressFlow(cypressFlowParameters)
}
Expand Down
Expand Up @@ -3,7 +3,8 @@ import hudson.util.Secret
import org.jenkinsci.plugins.workflow.libs.Library
import java.util.Calendar

@Library('pipelines-shared-library@RANCHER-741-Jenkins-Enhancements') _
@Library('pipelines-shared-library@RANCHER-1276') _
//@Library('pipelines-shared-library@RANCHER-741-Jenkins-Enhancements') _

properties([
buildDiscarder(logRotator(numToKeepStr: '50')),
Expand All @@ -17,8 +18,8 @@ properties([
string(name: 'ADMIN_USERNAME', defaultValue: "diku_admin", description: 'Tenant admin username', trim: true),
password(name: 'ADMIN_PASSWORD', defaultValueAsSecret: Secret.fromString('admin'), description: 'Tenant admin password'),
string(name: 'PARALLEL_EXEC_PARAMETERS', defaultValue: "", description: 'Cypress parallel execution parameters.\nExample --env grepTags="extendedPath --nonParallel"', trim: true),
string(name: 'SEQUENTIAL_EXEC_PARAMETERS', defaultValue: "", description: 'Cypress sequential execution parameters.\nExample: --env grepTags="smoke+nonParallel"', trim: true),
choice(name: 'NUMBER_OF_WORKERS', description: "Numbers of parallel cypress workers, if sequential run leave 1", choices: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]),
// string(name: 'SEQUENTIAL_EXEC_PARAMETERS', defaultValue: "", description: 'Cypress sequential execution parameters.\nExample: --env grepTags="smoke+nonParallel"', trim: true),
choice(name: 'NUMBER_OF_WORKERS', description: "Numbers of parallel cypress workers, if sequential run leave 1", choices: ["1", "2", "3", "4", "5", "6", "7", "8"]),
string(name: 'TIMEOUT', defaultValue: "4", description: '(HOURS) Timeout for tests execution', trim: true),
string(name: 'CUSTOM_BUILD_NAME', defaultValue: "", description: 'Custom name for build', trim: true),
string(name: 'TESTRAIL_PROJECTID', defaultValue: "", description: 'To enable TestRail integration, enter ProjectID from TestRail, ex. 22', trim: true),
Expand All @@ -43,20 +44,20 @@ Map cypressFlowParameters = [
adminUsername : params.ADMIN_USERNAME,
adminPassword : params.ADMIN_PASSWORD,
parallelExecParameters : params.PARALLEL_EXEC_PARAMETERS,
sequentialExecParameters: params.SEQUENTIAL_EXEC_PARAMETERS,
// sequentialExecParameters: params.SEQUENTIAL_EXEC_PARAMETERS,
testsTimeout : params.TIMEOUT,
testrailProjectID : params.TESTRAIL_PROJECTID,
testrailRunID : params.TESTRAIL_RUN_ID,
numberOfWorkers : params.NUMBER_OF_WORKERS,
agent : params.AGENT,
agent : 'cypress',
useReportPortal : "false"
]

ansiColor('xterm') {
node(params.AGENT) {
stage('Ini') {
buildName env.BUILD_ID
buildDescription ""
buildDescription "Branch: ${params.CYPRESS_BRANCH}\nEnv: ${cypressFlowParameters.tenantUrl}"
}
stage('[Conditional check]') {
Calendar cal = Calendar.getInstance()
Expand All @@ -79,7 +80,6 @@ ansiColor('xterm') {
println("Number of workers: " + params.NUMBER_OF_WORKERS.toInteger())
currentBuild.result = 'ABORTED'
error("Not a proper condition.")

}
}

Expand Down
10 changes: 10 additions & 0 deletions scripts/docker/cypress/factory/Dockerfile
@@ -0,0 +1,10 @@
ARG NODE_VERSION='18.16.0'
ARG YARN_VERSION='1.22.19'
ARG CHROME_VERSION='124.0.6367.60-1'
ARG CYPRESS_VERSION='12.0.0'

FROM cypress/factory:3.5.4

COPY . /opt/app
WORKDIR /opt/app
RUN npm install --save-dev cypress
17 changes: 17 additions & 0 deletions scripts/docker/cypress/factory/README.md
@@ -0,0 +1,17 @@
### How to build cypress custom image with [cypress/factory](https://hub.docker.com/r/cypress/factory)

- Edit Dockerfile with versions you need to build
- Build image
- Login to aws cli
- Retrive ECR token
- Push docker image

```bash
docker build . -t 732722833398.dkr.ecr.us-west-2.amazonaws.com/cypress/browsers:node-18.16.0-cypress-12.0.0-chrome-124.0.6367.60-1

aws configure

aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin 732722833398.dkr.ecr.us-west-2.amazonaws.com

docker push 732722833398.dkr.ecr.us-west-2.amazonaws.com/cypress/browsers:node-18.16.0-cypress-12.0.0-chrome-124.0.6367.60-1
```