Define parameters for triggering jobs 83/53483/1
authorJulien <zhang.jun3g@zte.com.cn>
Mon, 12 Mar 2018 01:13:25 +0000 (09:13 +0800)
committerJulien <zhang.jun3g@zte.com.cn>
Mon, 12 Mar 2018 01:13:25 +0000 (09:13 +0800)
In
https://wiki.jenkins.io/display/JENKINS/Plugins+affected+by+fix+for+SECURITY-170,
it indicates that:

    only build parameters that have been explicitly defined in a job's
    configuration will be available by default at build time. Any other
    arbitrary parameters added to a build by plugins will not be
    available by default.

It has been tested in sandbox.opnfv.org that only defined parameters can
be passed to the triggered jobs.

For parameters required by TESTAPI are common to all the projectes,
including installers, Functest, and Yardstick, it is convenient to
define a common macro and used by others.

Change-Id: Iac1da85445e1b5d75109ccd64b174f35151b9969
Signed-off-by: Julien <zhang.jun3g@zte.com.cn>
jjb/daisy4nfv/daisy-daily-jobs.yml
jjb/global/releng-macros.yml

index c354ca6..a9a0da2 100644 (file)
       - '{installer}-defaults'
       - '{slave-label}-defaults':
           installer: '{installer}'
-      - string:
-          name: DEPLOY_SCENARIO
-          default: '{scenario}'
-      - string:
-          name: INSTALLER_VERSION
-          default: ''
-      - string:
-          name: UPSTREAM_JOB_NAME
-          default: ''
-      - string:
-          name: UPSTREAM_BUILD_ID
-          default: ''
+      - 'testapi-parameter'
       - 'daisy-project-parameter':
           gs-pathname: '{gs-pathname}'
 
       - '{installer}-defaults'
       - '{slave-label}-defaults':
           installer: '{installer}'
-      - string:
-          name: DEPLOY_SCENARIO
-          default: 'os-nosdn-nofeature-ha'
+      - 'testapi-parameter'
       - 'daisy-project-parameter':
           gs-pathname: '{gs-pathname}'
       - string:
index 8f03234..205802f 100644 (file)
           name: GERRIT_REFSPEC
           default: 'refs/heads/{branch}'
           description: "Default refspec needed for manually triggering."
+
+- parameter:
+    name: testapi-parameter
+    parameters:
       - string:
           name: TESTAPI_URL
           default: 'http://testresults.opnfv.org/test/api/v1'
           description: "Default TestAPI URL, currently using v1"
+      - string:
+          name: DEPLOY_SCENARIO
+          default: 'os-nosdn-nofeature-ha'
+          description: "OPNFV deployment scenario"
+      - string:
+          name: INSTALLER_VERSION
+          default: 'master'
+          description: "Installer release version"
+      - string:
+          name: UPSTREAM_JOB_NAME
+          default: ''
+          description: "Parent job name in Jenkins"
+      - string:
+          name: UPSTREAM_BUILD_ID
+          default: ''
+          description: "Parent job build_id in Jenkins"
 
 - property:
     name: logrotate-default
             - shell: |
                 echo "export PROVISION_RESULT=PASS" >> $WORKSPACE/installer_track.sh
                 echo "export INSTALLER=$INSTALLER_TYPE" >> $WORKSPACE/installer_track.sh
-                echo "export TIMESTAMP_END="\'`date '+%Y-%m-%d %H:%M:%S.%3N'`\' > $WORKSPACE/installer_track.sh
+                echo "export TIMESTAMP_END="\'`date '+%Y-%m-%d %H:%M:%S.%3N'`\' >> $WORKSPACE/installer_track.sh
             - shell:
                 !include-raw: installer-report.sh
       - postbuildscript:
             - shell: |
                 echo "export PROVISION_RESULT=FAIL" >> $WORKSPACE/installer_track.sh
                 echo "export INSTALLER=$INSTALLER_TYPE" >> $WORKSPACE/installer_track.sh
-                echo "export TIMESTAMP_END="\'`date '+%Y-%m-%d %H:%M:%S.%3N'`\' > $WORKSPACE/installer_track.sh
+                echo "export TIMESTAMP_END="\'`date '+%Y-%m-%d %H:%M:%S.%3N'`\' >> $WORKSPACE/installer_track.sh
             - shell:
                 !include-raw: installer-report.sh