#354 C3I: Global parameters for jobs
Closed by mkovarik. Opened by mkovarik.
mkovarik/waiverdb c3i_improvements  into  master

Download 354.patch

Add global configuration for project
Use global.env file instead of setting global variables for each job.
Job environment file should contain configuration of template and should
be static. File global.env contains variables which are used by multiple
jobs. Typical content of global.env are URLs.

Variables priority:
  1) use variable in job env file
  2) use variable in global config if template contains it
  3) use default variable in yaml template
Installation of jobs using 'make install' will fail with error code
in case of issue with configuration and other jobs are not applied. This
behavior can be disabled by FAIL_ON_ERROR=false

Set HOME for Jenkins slaves
HOME environment variable is to /home/jenkins which is not writable.
Jenkins slave container has default value of HOME set to
/var/lib/jenkins. HOME variable is probably changed by jenkins plugin.

Do premerge testing with Jenkins files from the PR
Varibales for git checkout (WAIVERDB_GIT_REPO, WAIVERDB_GIT_BRANCH)
were evaluated during openshift template applications. Which caused that
PRs were tested with Jenkins file in master branch intead of PR ones.

Openshift BuildConfig is not able to specify git refs to be fetched and
PR refs are not available, to avoid this issue WAIVERDB_GIT_REF_COMMIT
contains SHA of last PR (or can be master branch).

@mkovarik Have you tested the use of $WAIVERDB_GIT_REF_COMMIT? The original problem was that If you specify a sha1 sum as the ref: value in a OpenShift BuildConfig, OpenShift assumes that ref exists on a branch under refs/heads/*. Because PR branches are created under refs/pull/*, OpenShift cannot find the sha1 for a PR, and the build will fail.

oc process accepts multiple --param-file options. It will use the first definition of a parameter it finds, and ignore the rest. It may be simpler to just pass --param-file ./$(JOBS_DIR)/global.env at the end of the command-line and remove the manual handling of the global params.

@mikeb
I have tested $WAIVERDB_GIT_REF_COMMIT (with sha sum) it worked, but I tested it inside forked repository, PR was from different branch of the same git and that worked. Now I can see that it does not work when PR is from different repository...

I was not aware of oc process behavior, but it causes issue with unknown parameters in global.env (not valid for all templates), command fails with it. It's possible to use param --ignore-unknown-parameters but that I don't want to apply on job env file.

Pull-Request has been closed by mkovarik

Metadata