#!/bin/bash
set -x
#
# called by hcron to trigger the nightly build pipeline! Must be added to a location
# on the PATH variable, of the runner account
#

# Update nightly build branch with most recent HEAD of pycmor
cd tmp
git clone -b nightly-builds git@gitlab.science.gc.ca:CanESM/ncconv.git
cd ncconv
git fetch --all 
git merge origin/pycmor --no-edit
git push origin nightly-builds
cd 
rm -rf tmp/ncconv

# launch pipeline
curl -X POST -F token=f701bd0f3eb501641b4f5d298b0437 -F ref=nightly-builds -F "variables[CONVERT_LST]=p2-his01:2005_2005:cpd103 c2-his01:200501_200512:cpd103"  https://gitlab.science.gc.ca/api/v3/projects/2557/trigger/builds
