Skip to content
Snippets Groups Projects

Trigger builds on CI instead of using webhooks

Merged Daniel Juarez Gonzalez requested to merge testing_ci_build into master
2 files
+ 58
11
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 38
11
stages:
stages:
- build
- build
mkdocs_test_build:
.prod_variables: &prod_variables
 
OC_OPTIONS: --token ${LINUXWEB_PROD_OPENSHIFT} --server https://openshift.cern.ch --namespace linux
 
 
.dev_variables: &dev_variables
 
OC_OPTIONS: --token ${LINUXWEB_QA_OPENSHIFT} --server https://openshift.cern.ch --namespace linux-qa
 
 
.common_functions: &common_functions |
 
# redefine oc to use the appropriate options. alias doesn't work here: https://askubuntu.com/a/98786
 
function oc {
 
/bin/oc $OC_OPTIONS "$@"
 
}
 
 
.common_script: &common_script |
 
oc start-build linux-docs --wait
 
 
build_test:
 
stage: build
 
image: gitlab-registry.cern.ch/paas-tools/openshift-client
 
before_script:
 
- *common_functions
 
script:
 
# We need to alter buildConfig to point to the branch (CI_COMMIT_REF_NAME) reference this CI is triggering from
 
# Use double quotes so variable interpolation works, but this requires scaping JSON patch
 
- oc patch buildconfig linux-docs -p "{\"spec\":{\"source\":{\"git\":{\"ref\":\"$CI_COMMIT_REF_NAME\"}}}}"
 
- *common_script
 
except:
 
- master
 
variables:
 
<<: *dev_variables
 
 
build_prod:
stage: build
stage: build
image: gitlab-registry.cern.ch/authoring/documentation/s2i-mkdocs-container:1.1
image: gitlab-registry.cern.ch/paas-tools/openshift-client
before_script:
before_script:
- export LC_ALL=en_US.utf-8
- *common_functions
- export LANG=en_US.utf-8
script:
script:
- export PYTHONPATH=$PYTHONPATH:/opt/app-root/lib/python3.6/site-packages
- *common_script
- /opt/rh/rh-python36/root/bin/pip install --cache-dir /opt/app-root/.cache --target /opt/app-root/lib/python3.6/site-packages -r requirements.txt
variables:
- /opt/rh/rh-python36/root/bin/mkdocs build
<<: *prod_variables
artifacts:
only:
paths:
- master
- site
expire_in: 1 week
Loading