Jenkins setup:
Jenkins: 2.448
OS: Linux - 4.19.0-17-amd64
Java: 17.0.10 - Debian (OpenJDK 64-Bit Server VM)
Addons at pastebin: ant:497.v94e7d9fffa_b_9antisamy-markup-formatter:162.v0e6ec0fcfcf6apache-htt - Pastebin.com
Hello all, I am trying to implement a pipeline that will run cypress tests before deploying a containerized version of the FE.
I have the following Pipeline
pipeline {
agent {
label '{functional_node}'
}
stages {
stage('TEST') {
agent {
docker {
image 'cypress/base:20.9.0'
}
}
steps{
git branch: 'development',
credentialsId: '{redacted}',
url: '{URL}'
sh 'ng serve'
sh 'npm i'
sh 'npm run cypress:run'
}
}
stage('Build and Deploy Docker') {
steps {
agent {
label '{functional_node}'
}
git branch: 'development',
credentialsId: '{redacted}',
url: '{URL}'
sh 'cp -f /apps/jenkins/workspace/"${JOB_NAME}"/src/environments/environment.ts /apps/jenkins/workspace/"${JOB_NAME}"/src/environments/environment.prod.ts'
sh 'docker build . -t {just_a_name}:latest '
sh 'docker rm -vf $(docker ps -a -q --filter="name={just_a_name}")'
sh 'docker run -d --restart unless-stopped -p 90:80 --name {just_a_name} {just_a_name}:latest'
sh 'docker system prune -f'
}
}
}
}
The Git Repo:
The repo is connected and can be read from without issue it contains the Dockerfile used to ultimately create the docker image and then run it. Further it has a package.json which outlines the following to lines in the scripts section:
"cypress:open": "cypress open",
"cypress:run":"cypress run"
Important Vars substituted:
{functional_node}
is a dockerhost which contains several different running containers of various applications and this is where ultimately I would like the final tested FE application to end up running.
I thought this would begin the pipe from my {functional_node}
use the docker that exists there to pull down the dockerhub image for cypress, fetch the code base, and then run my declared sh commands hopefully starting the angular serve, installing all npm packages, and finally running the cypress run script.
This is not what happens instead I see this:
/apps/jenkins/workspace/cypress-testing@tmp/durable-77aede15/script.sh.copy: 1: /apps/jenkins/workspace/cypress-testing@tmp/durable-77aede15/script.sh.copy: docker: not found
And… I can’t really make heads or tails of what’s happening to any assistance would be really appreciated.