Meridio: Remove wrappers and add credentials and timeout in jenkinsfile 69/15069/1
authorLionel Jouin <lionel.jouin@est.tech>
Fri, 9 Sep 2022 11:55:17 +0000 (13:55 +0200)
committerLionel Jouin <lionel.jouin@est.tech>
Fri, 9 Sep 2022 11:55:17 +0000 (13:55 +0200)
- Wrappers doesn't seems to be used from the job template
- The timeout and credentials wrappers have been added directly inside
  the Jenkinsfile

Change-Id: I394ae0f28f777eae223a0751cc4cea2edd9c1aee

jjb/nsm/Jenkinsfile
jjb/nsm/meridio-periodic.yaml
jjb/nsm/meridio-pull-request.yaml

index 4362fc663ea2302429a1b893a3d78499e478d166..a902f5032e2644b2eb6458d65de0885f6c3af392 100644 (file)
@@ -24,7 +24,7 @@ in_progress = 'In Progress.'
 completed = 'Completed.'
 failed = 'Failed'
 
-node ('nordix-nsm-build-ubuntu1804') {
+node('nordix-nsm-build-ubuntu1804') {
     build_number = env.BUILD_NUMBER
     workspace = env.WORKSPACE
     ws("${workspace}/${build_number}") {
@@ -38,37 +38,39 @@ node ('nordix-nsm-build-ubuntu1804') {
         def image_registry = params.IMAGE_REGISTRY
         def local_version =  "${env.JOB_NAME}-${build_number}"
 
-        stage('Clone/Checkout') {
-            git branch: default_branch, url: git_project
-            checkout([
-                $class: 'GitSCM',
-                branches: [[name: current_branch]],
-                extensions: [],
-                userRemoteConfigs: [[
-                    refspec: '+refs/pull/*/head:refs/remotes/origin/pr/*',
-                    url: git_project
-                ]]
-            ])
-            sh 'git show'
-        }
-        stage('Verify') {
-            Verify().call()
-        }
-        stage('Docker login') {
-            wrap([$class: 'MaskPasswordsBuildWrapper', varPasswordPairs: [[password: env.HARBOR_USERNAME, var: 'HARBOR_USERNAME'], [password: env.HARBOR_PASSWORD, var: 'HARBOR_PASSWORD'], [password: image_registry, var: 'IMAGE_REGISTRY']]]) {
-                sh '''#!/bin/bash -eu
-                echo ${HARBOR_PASSWORD} | docker login --username ${HARBOR_USERNAME} --password-stdin ${IMAGE_REGISTRY}
-                '''
+        timeout(30) {
+            stage('Clone/Checkout') {
+                git branch: default_branch, url: git_project
+                checkout([
+                    $class: 'GitSCM',
+                    branches: [[name: current_branch]],
+                    extensions: [],
+                    userRemoteConfigs: [[
+                        refspec: '+refs/pull/*/head:refs/remotes/origin/pr/*',
+                        url: git_project
+                    ]]
+                ])
+                sh 'git show'
+            }
+            stage('Verify') {
+                Verify().call()
+            }
+            stage('Docker login') {
+                withCredentials([usernamePassword(credentialsId: 'nordixinfra-harbor-creds-wrapper', passwordVariable: 'HARBOR_PASSWORD', usernameVariable: 'HARBOR_USERNAME')]) {
+                    sh '''#!/bin/bash -eu
+                    echo $HARBOR_PASSWORD | docker login --username $HARBOR_USERNAME --password-stdin $IMAGE_REGISTRY
+                    '''
+                }
+            }
+            stage('Base Image') {
+                BaseImage(version, build_steps, image_registry, local_version).call()
+            }
+            stage('Images') {
+                Images(image_names, version, build_steps, image_registry, local_version).call()
+            }
+            stage('E2E') {
+                E2e(e2e_enabled).call()
             }
-        }
-        stage('Base Image') {
-            BaseImage(version, build_steps, image_registry, local_version).call()
-        }
-        stage('Images') {
-            Images(image_names, version, build_steps, image_registry, local_version).call()
-        }
-        stage('E2E') {
-            E2e(e2e_enabled).call()
         }
         stage('Cleanup') {
             Cleanup()
index bac35f2c7573c8140618b696eced96c914238179..9ffe7e9d8e36fc44e2cf940994feb8ce4f77a366 100644 (file)
       - pollscm:
           cron: '@midnight'
 
-    wrappers:
-      - build-timeout:
-          timeout: 30
-      - nordixinfra-harbor-creds-wrapper
-      - mask-passwords
-
     dsl: 
       !include-raw-escape: Jenkinsfile
 
index ad556d0c449a4e5cf4990d83dc970dd13d6c0256..61e341f4cc44d0ba015137946776426c3bef3466 100644 (file)
           only-trigger-phrase: false
           cron: 'H/5 * * * *'
 
-    wrappers:
-      - build-timeout:
-          timeout: 30
-      - nordixinfra-harbor-creds-wrapper
-      - mask-passwords
-
     dsl: 
       !include-raw-escape: Jenkinsfile