Merge branch 'skopeo' of github.com:pittar/spring-petclinic into skopeo

This commit is contained in:
Andrew Pitt 2020-01-06 12:16:41 -05:00
commit 60795b45c3
2 changed files with 74 additions and 16 deletions

20
Jenkinsfile vendored
View file

@ -4,6 +4,10 @@ try {
def gitSourceRef=env.GIT_SOURCE_REF
def project=""
def projectVersion=""
def quayUser=env.QUAY_USER
def quayPassword=env.QUAY_PASSWORD
def ocpUser=env.OCP_USER
def ocpPassword=env.OCP_PASSWORD
node("maven") {
stage("Initialize") {
project = env.PROJECT_NAME
@ -37,14 +41,6 @@ try {
}
}
}
stage("Tag DEV") {
echo "Tag image to DEV"
openshift.withCluster() {
openshift.withProject('cicd') {
openshift.tag("${appName}:latest", "${appName}:dev")
}
}
}
stage("Deploy DEV") {
echo "Deploy to DEV."
openshift.withCluster() {
@ -56,14 +52,6 @@ try {
}
}
}
stage("Tag for QA") {
echo "Tag to UAT"
openshift.withCluster() {
openshift.withProject('cicd') {
openshift.tag("${appName}:dev", "${appName}:uat")
}
}
}
stage("Deploy UAT") {
echo "Deploy to UAT."
openshift.withCluster() {

70
TestJenkinsfile Normal file
View file

@ -0,0 +1,70 @@
try {
def appName=env.APP_NAME
def gitSourceUrl=env.GIT_SOURCE_URL
def gitSourceRef=env.GIT_SOURCE_REF
def project=""
def projectVersion=""
node('jenkins-slave-skopeo') {
def quayUser=env.QUAY_USER
def quayPassword=env.QUAY_PASS
def ocpUser=env.OCP_USER
def ocpPassword=env.OCP_PASS
stage('Clair Container Vulnerability Scan') {
echo "Printing ocp and quay users:"
echo "OCP: ${ocpUser}"
echo "OCP from env: ${env.OCP_USER}"
echo "Quay: ${quayUser}"
echo "Git repo: ${gitSourceUrl}"
sh "oc login -u $ocpUser -p $ocpPassword --insecure-skip-tls-verify https://api.cluster-ottawa-7b89.ottawa-7b89.example.opentlc.com:6443 2>&1"
sh 'skopeo --debug copy --src-creds="$(oc whoami)":"$(oc whoami -t)" --src-tls-verify=false --dest-tls-verify=false' + " --dest-creds=$quayUser:$quayPassword docker://docker-registry.default.svc:5000/cicd/petclinic:latest docker://quay.io/$quayUser/petclinic:latest"
}
stage("Tag DEV") {
echo "Tag image to DEV"
openshift.withCluster() {
openshift.withProject('cicd') {
openshift.tag("${appName}:latest", "${appName}:dev")
}
}
}
stage("Deploy DEV") {
echo "Deploy to DEV."
openshift.withCluster() {
openshift.withProject("${appName}-dev") {
echo "Rolling out to DEV."
def dc = openshift.selector('dc', "${appName}")
dc.rollout().latest()
dc.rollout().status()
}
}
}
stage("Tag for QA") {
echo "Tag to UAT"
openshift.withCluster() {
openshift.withProject('cicd') {
openshift.tag("${appName}:dev", "${appName}:uat")
}
}
}
stage("Deploy UAT") {
echo "Deploy to UAT."
openshift.withCluster() {
openshift.withProject("${appName}-uat") {
echo "Rolling out to UAT."
def dc = openshift.selector('dc', "${appName}")
dc.rollout().latest()
dc.rollout().status()
}
}
}
}
} catch (err) {
echo "in catch block"
echo "Caught: ${err}"
currentBuild.result = 'FAILURE'
throw err
}