Added .gitlab-ci.yml

This commit is contained in:
Scott Charlton 2020-01-18 23:42:45 -07:00
parent 4968927900
commit 9273992482
10 changed files with 701 additions and 0 deletions

130
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,130 @@
#
# https://code.chs.usgs.gov/coupled/iphreeqc
#
image: buildpack-deps:bionic-scm
stages:
- sync
- trigger
before_script:
- eval $(ssh-agent -s)
- echo "${SSH_PRIVATE_KEY_ENC}" | base64 --decode | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan ${CI_SERVER_HOST} >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- git config --global user.email "darth@empire.com"
- git config --global user.name "Darth Vader"
subtree-sync:
stage: sync
##
## Only run if on the master branch and the variable GROUP is set
##
## change this to
## only:
## - master@$GROUP/iphreeqc
## and set GROUP to coupled before merge
only:
refs:
- master
variables:
- $GROUP
script:
##
## Must re-clone in order for the subtree merge to work
## tried re-setting the url for the origin but didn't work
##
- cd ..
- rm -rf ${CI_PROJECT_NAME}
- git clone git@${CI_SERVER_HOST}:${CI_PROJECT_PATH}.git
- cd ${CI_PROJECT_NAME}
##
## Sync subtrees
##
- |
#!/bin/bash -ex
#
# iphreeqc/ git@${CI_SERVER_HOST}:${GROUP}/iphreeqc.git
# ├─database/ ├─git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc3-database.git* database*
# ├─examples/ │ └─examples
# │ ├─c/ │ ├─git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc-commanuscript-cgfinal-examples-c.git* examples/c*
# │ ├─com/ │ ├─git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc-commanuscript-cgfinal-examples-com.git* examples/com*
# │ └─fortran/ │ └─git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc-COMManuscript-CGfinal-examples-fortran.git* examples/fortran*
# ├─phreeqc3-doc/ ├─git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc3-doc.git* phreeqc3-doc*
# ├─phreeqc3-examples/ ├─git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc3-examples.git* phreeqc3-examples*
# └─src/ └─git@${CI_SERVER_HOST}:${GROUP}/subtrees/iphreeqc-src.git% src%
# └─phreeqcpp/ └─git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc3-src.git src/phreeqcpp
# └─common/ └─git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc3-src-common.git src/phreeqcpp/common
git_subtree() {
git subtree "${1}" --prefix="${2}" "${4}" master 2>&1 | grep -v "^[[:digit:]].*/[[:digit:]].*"
}
declare -A urls=( \
["iphreeqc-src"]="git@${CI_SERVER_HOST}:${GROUP}/subtrees/iphreeqc-src.git" \
["phreeqc-commanuscript-cgfinal-examples-c"]="git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc-commanuscript-cgfinal-examples-c.git" \
["phreeqc-commanuscript-cgfinal-examples-com"]="git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc-commanuscript-cgfinal-examples-com.git" \
["phreeqc-COMManuscript-CGfinal-examples-fortran"]="git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc-COMManuscript-CGfinal-examples-fortran.git" \
["phreeqc3-database"]="git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc3-database.git" \
["phreeqc3-doc"]="git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc3-doc.git" \
["phreeqc3-examples"]="git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc3-examples.git" \
)
declare -A prefixes=( \
["iphreeqc-src"]="src" \
["phreeqc-commanuscript-cgfinal-examples-c"]="examples/c" \
["phreeqc-commanuscript-cgfinal-examples-com"]="examples/com" \
["phreeqc-COMManuscript-CGfinal-examples-fortran"]="examples/fortran" \
["phreeqc3-database"]="database" \
["phreeqc3-doc"]="phreeqc3-doc" \
["phreeqc3-examples"]="phreeqc3-examples" \
)
export GIT_EDITOR=true
for remote in "${!urls[@]}"; do
git_subtree "pull" "${prefixes[$remote]}" "$remote" "${urls[$remote]}"
done
for remote in "${!urls[@]}"; do
git_subtree "push" "${prefixes[$remote]}" "$remote" "${urls[$remote]}"
done
git push origin master
git status
trigger-downstream:
stage: trigger
##
## Only run if on the master branch and the variable GROUP is set
##
## change this to
## only:
## - master@$GROUP/iphreeqc
## and set GROUP to coupled before merge
only:
refs:
- master
variables:
- $GROUP
## Downstream Projects
## triggers and ids are stored at the group level
## webmod https://code.chs.usgs.gov/coupled/webmod
script:
- echo triggering webmod
- curl -X POST -F token=${WEBMOD_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${WEBMOD_ID}/trigger/pipeline
## Upstream Projects
## iphreeqc-src https://code.chs.usgs.gov/coupled/subtrees/iphreeqc-src
## phreeqc-commanuscript-cgfinal-examples-c https://code.chs.usgs.gov/coupled/subtrees/phreeqc-commanuscript-cgfinal-examples-c
## phreeqc-commanuscript-cgfinal-examples-com https://code.chs.usgs.gov/coupled/subtrees/phreeqc-commanuscript-cgfinal-examples-com
## phreeqc-COMManuscript-CGfinal-examples-fortran https://code.chs.usgs.gov/coupled/subtrees/phreeqc-COMManuscript-CGfinal-examples-fortran
## phreeqc3-database https://code.chs.usgs.gov/coupled/subtrees/phreeqc3-database
## phreeqc3-doc https://code.chs.usgs.gov/coupled/subtrees/phreeqc3-doc
## phreeqc3-examples https://code.chs.usgs.gov/coupled/subtrees/phreeqc3-examples

54
database/.gitlab-ci.yml Normal file
View File

@ -0,0 +1,54 @@
#
# https://code.chs.usgs.gov/coupled/subtrees/phreeqc3-database
#
image: buildpack-deps:bionic-scm
stages:
- trigger
before_script:
- eval $(ssh-agent -s)
- echo "${SSH_PRIVATE_KEY_ENC}" | base64 --decode | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan ${CI_SERVER_HOST} >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- git config --global user.email "darth@empire.com"
- git config --global user.name "Darth Vader"
trigger-downstream:
stage: trigger
##
## Only run if on the master branch and the variable GROUP is set
##
## change this to
## only:
## - master@$GROUP/subtrees/phreeqc3-database
## and set GROUP to coupled before merge
only:
refs:
- master
variables:
- $GROUP
## Downstream Projects
## triggers and ids are stored at the group level
## iphreeqc https://code.chs.usgs.gov/coupled/iphreeqc
## iphreeqccom https://code.chs.usgs.gov/coupled/iphreeqccom
## phreeqcrm https://code.chs.usgs.gov/coupled/phreeqcrm
## phreeqc3 https://code.chs.usgs.gov/coupled/phreeqc3
## wphast https://code.chs.usgs.gov/coupled/wphast
script:
- echo triggering iphreeqc
- curl -X POST -F token=${IPHREEQC_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${IPHREEQC_ID}/trigger/pipeline
- echo triggering iphreeqccom
- curl -X POST -F token=${IPHREEQCCOM_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${IPHREEQCCOM_ID}/trigger/pipeline
- echo triggering phreeqcrm
- curl -X POST -F token=${PHREEQCRM_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${PHREEQCRM_ID}/trigger/pipeline
- echo triggering phreeqc3
- curl -X POST -F token=${PHREEQC3_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${PHREEQC3_ID}/trigger/pipeline
- echo triggering wphast
- curl -X POST -F token=${WPHAST_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${WPHAST_ID}/trigger/pipeline
## Upstream Projects
## none

48
examples/c/.gitlab-ci.yml Normal file
View File

@ -0,0 +1,48 @@
#
# https://code.chs.usgs.gov/coupled/subtrees/phreeqc-commanuscript-cgfinal-examples-c
#
image: buildpack-deps:bionic-scm
stages:
- trigger
before_script:
- eval $(ssh-agent -s)
- echo "${SSH_PRIVATE_KEY_ENC}" | base64 --decode | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan ${CI_SERVER_HOST} >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- git config --global user.email "darth@empire.com"
- git config --global user.name "Darth Vader"
trigger-downstream:
stage: trigger
##
## Only run if on the master branch and the variable GROUP is set
##
## change this to
## only:
## - master@$GROUP/subtrees/phreeqc-commanuscript-cgfinal-examples-c
## and set GROUP to coupled before merge
only:
refs:
- master
variables:
- $GROUP
## Downstream Projects
## triggers and ids are stored at the group level
## iphreeqc https://code.chs.usgs.gov/coupled/iphreeqc
## iphreeqccom https://code.chs.usgs.gov/coupled/iphreeqccom
## phreeqc https://code.chs.usgs.gov/coupled/phreeqc
script:
- echo triggering iphreeqc
- curl -X POST -F token=${IPHREEQC_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${IPHREEQC_ID}/trigger/pipeline
- echo triggering iphreeqccom
- curl -X POST -F token=${IPHREEQCCOM_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${IPHREEQCCOM_ID}/trigger/pipeline
- echo triggering phreeqc
- curl -X POST -F token=${PHREEQC_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${PHREEQC_ID}/trigger/pipeline
## Upstream Projects
## none

View File

@ -0,0 +1,48 @@
#
# https://code.chs.usgs.gov/coupled/subtrees/phreeqc-commanuscript-cgfinal-examples-com
#
image: buildpack-deps:bionic-scm
stages:
- trigger
before_script:
- eval $(ssh-agent -s)
- echo "${SSH_PRIVATE_KEY_ENC}" | base64 --decode | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan ${CI_SERVER_HOST} >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- git config --global user.email "darth@empire.com"
- git config --global user.name "Darth Vader"
trigger-downstream:
stage: trigger
##
## Only run if on the master branch and the variable GROUP is set
##
## change this to
## only:
## - master@$GROUP/subtrees/phreeqc-commanuscript-cgfinal-examples-com
## and set GROUP to coupled before merge
only:
refs:
- master
variables:
- $GROUP
## Downstream Projects
## triggers and ids are stored at the group level
## iphreeqc https://code.chs.usgs.gov/coupled/iphreeqc
## iphreeqccom https://code.chs.usgs.gov/coupled/iphreeqccom
## phreeqc https://code.chs.usgs.gov/coupled/phreeqc
script:
- echo triggering iphreeqc
- curl -X POST -F token=${IPHREEQC_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${IPHREEQC_ID}/trigger/pipeline
- echo triggering iphreeqccom
- curl -X POST -F token=${IPHREEQCCOM_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${IPHREEQCCOM_ID}/trigger/pipeline
- echo triggering phreeqc
- curl -X POST -F token=${PHREEQC_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${PHREEQC_ID}/trigger/pipeline
## Upstream Projects
## none

View File

@ -0,0 +1,48 @@
#
# https://code.chs.usgs.gov/coupled/subtrees/phreeqc-COMManuscript-CGfinal-examples-fortran
#
image: buildpack-deps:bionic-scm
stages:
- trigger
before_script:
- eval $(ssh-agent -s)
- echo "${SSH_PRIVATE_KEY_ENC}" | base64 --decode | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan ${CI_SERVER_HOST} >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- git config --global user.email "darth@empire.com"
- git config --global user.name "Darth Vader"
trigger-downstream:
stage: trigger
##
## Only run if on the master branch and the variable GROUP is set
##
## change this to
## only:
## - master@$GROUP/subtrees/phreeqc-COMManuscript-CGfinal-examples-fortran
## and set GROUP to coupled before merge
only:
refs:
- master
variables:
- $GROUP
## Downstream Projects
## triggers and ids are stored at the group level
## iphreeqc https://code.chs.usgs.gov/coupled/iphreeqc
## iphreeqccom https://code.chs.usgs.gov/coupled/iphreeqccom
## phreeqc https://code.chs.usgs.gov/coupled/phreeqc
script:
- echo triggering iphreeqc
- curl -X POST -F token=${IPHREEQC_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${IPHREEQC_ID}/trigger/pipeline
- echo triggering iphreeqccom
- curl -X POST -F token=${IPHREEQCCOM_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${IPHREEQCCOM_ID}/trigger/pipeline
- echo triggering phreeqc
- curl -X POST -F token=${PHREEQC_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${PHREEQC_ID}/trigger/pipeline
## Upstream Projects
## none

View File

@ -0,0 +1,51 @@
#
# https://code.chs.usgs.gov/coupled/subtrees/phreeqc3-doc
#
image: buildpack-deps:bionic-scm
stages:
- trigger
before_script:
- eval $(ssh-agent -s)
- echo "${SSH_PRIVATE_KEY_ENC}" | base64 --decode | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan ${CI_SERVER_HOST} >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- git config --global user.email "darth@empire.com"
- git config --global user.name "Darth Vader"
trigger-downstream:
stage: trigger
##
## Only run if on the master branch and the variable GROUP is set
##
## change this to
## only:
## - master@$GROUP/subtrees/phreeqc3-doc
## and set GROUP to coupled before merge
only:
refs:
- master
variables:
- $GROUP
## Downstream Projects
## triggers and ids are stored at the group level
## iphreeqc https://code.chs.usgs.gov/coupled/iphreeqc
## iphreeqccom https://code.chs.usgs.gov/coupled/iphreeqccom
## phast3-doc https://code.chs.usgs.gov/coupled/subtrees/phast3-doc
## phreeqc3 https://code.chs.usgs.gov/coupled/phreeqc3
script:
- echo triggering iphreeqc
- curl -X POST -F token=${IPHREEQC_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${IPHREEQC_ID}/trigger/pipeline
- echo triggering iphreeqccom
- curl -X POST -F token=${IPHREEQCCOM_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${IPHREEQCCOM_ID}/trigger/pipeline
- echo triggering phast3-doc PHAST3_DOC_TRIGGER PHAST3_DOC_ID
- curl -X POST -F token=${PHAST3_DOC_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${PHAST3_DOC_ID}/trigger/pipeline
- echo triggering phreeqc3 PHREEQC3_TRIGGER PHREEQC3_ID
- curl -X POST -F token=${PHREEQC3_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${PHREEQC3_ID}/trigger/pipeline
## Upstream Projects
## none

View File

@ -0,0 +1,45 @@
#
# https://code.chs.usgs.gov/coupled/subtrees/phreeqc3-examples
#
image: buildpack-deps:bionic-scm
stages:
- trigger
before_script:
- eval $(ssh-agent -s)
- echo "${SSH_PRIVATE_KEY_ENC}" | base64 --decode | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan ${CI_SERVER_HOST} >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- git config --global user.email "darth@empire.com"
- git config --global user.name "Darth Vader"
trigger-downstream:
stage: trigger
##
## Only run if on the master branch and the variable GROUP is set
##
## change this to
## only:
## - master@$GROUP/subtrees/phreeqc3-examples
## and set GROUP to coupled before merge
only:
refs:
- master
variables:
- $GROUP
## Downstream Projects
## triggers and ids are stored at the group level
## iphreeqc https://code.chs.usgs.gov/coupled/iphreeqc
## phreeqc3 https://code.chs.usgs.gov/coupled/phreeqc3
script:
- echo triggering iphreeqc
- curl -X POST -F token=${IPHREEQC_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${IPHREEQC_ID}/trigger/pipeline
- echo triggering phreeqc3
- curl -X POST -F token=${PHREEQC3_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${PHREEQC3_ID}/trigger/pipeline
## Upstream Projects
## none

122
src/.gitlab-ci.yml Normal file
View File

@ -0,0 +1,122 @@
#
# https://code.chs.usgs.gov/coupled/subtrees/iphreeqc-src
#
image: buildpack-deps:bionic-scm
stages:
- sync
- trigger
before_script:
- eval $(ssh-agent -s)
- echo "${SSH_PRIVATE_KEY_ENC}" | base64 --decode | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan ${CI_SERVER_HOST} >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- git config --global user.email "darth@empire.com"
- git config --global user.name "Darth Vader"
subtree-sync:
stage: sync
##
## Only run if on the master branch and the variable GROUP is set
##
## change this to
## only:
## - master@$GROUP/subtrees/iphreeqc-src
## and set GROUP to coupled before merge
only:
refs:
- master
variables:
- $GROUP
script:
##
## Must re-clone in order for the subtree merge to work
## tried re-setting the url for the origin but didn't work
##
- cd ..
- rm -rf ${CI_PROJECT_NAME}
- git clone git@${CI_SERVER_HOST}:${CI_PROJECT_PATH}.git
- cd ${CI_PROJECT_NAME}
##
## Sync subtrees
##
- |
#!/bin/bash -ex
#
# IPhreeqc/ git@${CI_SERVER_HOST}:${GROUP}/IPhreeqc.git
# ├─database/ ├─git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc3-database.git database
# ├─examples/ │ └─examples
# │ ├─c/ │ ├─git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc-COMManuscript-CGfinal-examples-c.git examples/c
# │ ├─com/ │ ├─git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc-COMManuscript-CGfinal-examples-com.git examples/com
# │ └─fortran/ │ └─git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc-COMManuscript-CGfinal-examples-fortran.git examples/fortran
# ├─phreeqc3-doc/ ├─git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc3-doc.git phreeqc3-doc
# ├─phreeqc3-examples/ ├─git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc3-examples.git phreeqc3-examples
# └─src/ └─git@${CI_SERVER_HOST}:${GROUP}/subtrees/IPhreeqc-src.git src
# └─phreeqcpp/ └─git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc3-src.git src/phreeqcpp
# └─common/ └─git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc3-src-common.git src/phreeqcpp/common
#
# IPhreeqc-src/ git@${CI_SERVER_HOST}:${GROUP}/subtrees/IPhreeqc-src.git
# └─phreeqcpp/ └─git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc3-src.git phreeqcpp
# └─common/ └─git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc3-src-common.git phreeqcpp/common
git_subtree() {
git subtree "${1}" --prefix="${2}" "${4}" master 2>&1 | grep -v "^[[:digit:]].*/[[:digit:]].*"
}
declare -A urls=( \
["phreeqc3-src"]="git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc3-src.git" \
)
declare -A prefixes=( \
["phreeqc3-src"]="phreeqcpp" \
)
export GIT_EDITOR=true
for remote in "${!urls[@]}"; do
git_subtree "pull" "${prefixes[$remote]}" "$remote" "${urls[$remote]}"
done
for remote in "${!urls[@]}"; do
git_subtree "push" "${prefixes[$remote]}" "$remote" "${urls[$remote]}"
done
git push origin master
git status
trigger-downstream:
stage: trigger
##
## Only run if on the master branch and the variable GROUP is set
##
## change this to
## only:
## - master@$GROUP/subtrees/iphreeqc-src
## and set GROUP to coupled before merge
only:
refs:
- master
variables:
- $GROUP
## Downstream Projects
## triggers and ids are stored at the group level
## iphreeqc https://code.chs.usgs.gov/coupled/iphreeqc
## iphreeqccom https://code.chs.usgs.gov/coupled/iphreeqccom
## phreeqcrm-src https://code.chs.usgs.gov/coupled/subtrees/phreeqcrm-src
script:
- echo triggering iphreeqc
- curl -X POST -F token=${IPHREEQC_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${IPHREEQC_ID}/trigger/pipeline
- echo triggering iphreeqccom
- curl -X POST -F token=${IPHREEQCCOM_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${IPHREEQCCOM_ID}/trigger/pipeline
- echo triggering phreeqcrm-src
- curl -X POST -F token=${PHREEQCRM_SRC_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${PHREEQCRM_SRC_ID}/trigger/pipeline
## Upstream Projects
## phreeqc3-src https://code.chs.usgs.gov/coupled/subtrees/phreeqc3-src

View File

@ -0,0 +1,110 @@
#
# https://code.chs.usgs.gov/coupled/subtrees/phreeqc3-src
#
image: buildpack-deps:bionic-scm
stages:
- sync
- trigger
before_script:
- eval $(ssh-agent -s)
- echo "${SSH_PRIVATE_KEY_ENC}" | base64 --decode | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan ${CI_SERVER_HOST} >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- git config --global user.email "darth@empire.com"
- git config --global user.name "Darth Vader"
subtree-sync:
stage: sync
##
## Only run if on the master branch and the variable GROUP is set
##
## change this to
## only:
## - master@$GROUP/subtrees/phreeqc3-src
## and set GROUP to coupled before merge
only:
refs:
- master
variables:
- $GROUP
script:
##
## Must re-clone in order for the subtree merge to work
## tried re-setting the url for the origin but didn't work
##
- cd ..
- rm -rf ${CI_PROJECT_NAME}
- git clone git@${CI_SERVER_HOST}:${CI_PROJECT_PATH}.git
- cd ${CI_PROJECT_NAME}
##
## Sync subtrees
##
- |
#!/bin/bash -ex
#
# phreeqc3/ git@${CI_SERVER_HOST}:${GROUP}/phreeqc3.git
# ├─database/ ├─git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc3-database.git database
# ├─doc/ ├─git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc3-doc.git doc
# ├─examples/ ├─git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc3-examples.git examples
# └─src/ └─git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc3-src.git src
# └─common/ └─git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc3-src-common.git src/common
git_subtree() {
git subtree "${1}" --prefix="${2}" "${4}" master 2>&1 | grep -v "^[[:digit:]].*/[[:digit:]].*"
}
declare -A urls=( \
["phreeqc3-src-common"]="git@${CI_SERVER_HOST}:${GROUP}/subtrees/phreeqc3-src-common.git" \
)
declare -A prefixes=( \
["phreeqc3-src-common"]="common" \
)
export GIT_EDITOR=true
for remote in "${!urls[@]}"; do
git_subtree "pull" "${prefixes[$remote]}" "$remote" "${urls[$remote]}"
done
for remote in "${!urls[@]}"; do
git_subtree "push" "${prefixes[$remote]}" "$remote" "${urls[$remote]}"
done
git push origin master
git status
trigger-downstream:
stage: trigger
##
## Only run if on the master branch and the variable GROUP is set
##
## change this to
## only:
## - master@$GROUP/subtrees/phreeqc3-src
## and set GROUP to coupled before merge
only:
refs:
- master
variables:
- $GROUP
## Downstream Projects
## triggers and ids are stored at the group level
## iphreeqc-src https://code.chs.usgs.gov/coupled/subtrees/iphreeqc-src
## phreeqc3 https://code.chs.usgs.gov/coupled/phreeqc3
script:
- echo triggering iphreeqc-src
- curl -X POST -F token=${IPHREEQC_SRC_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${IPHREEQC_SRC_ID}/trigger/pipeline
- echo triggering phreeqc3
- curl -X POST -F token=${PHREEQC3_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${PHREEQC3_ID}/trigger/pipeline
## Upstream Projects
## phreeqc3-src-common https://code.chs.usgs.gov/coupled/subtrees/phreeqc3-src-common

View File

@ -0,0 +1,45 @@
#
# https://code.chs.usgs.gov/coupled/subtrees/phreeqc3-src-common
#
image: buildpack-deps:bionic-scm
stages:
- trigger
before_script:
- eval $(ssh-agent -s)
- echo "${SSH_PRIVATE_KEY_ENC}" | base64 --decode | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan ${CI_SERVER_HOST} >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- git config --global user.email "darth@empire.com"
- git config --global user.name "Darth Vader"
trigger-downstream:
stage: trigger
##
## Only run if on the master branch and the variable GROUP is set
##
## change this to
## only:
## - master@$GROUP/subtrees/phreeqc3-src-common
## and set GROUP to coupled before merge
only:
refs:
- master
variables:
- $GROUP
## Downstream Projects
## triggers and ids are stored at the group level
## phreeqc3-src https://code.chs.usgs.gov/coupled/subtrees/phreeqc3-src
## wphast https://code.chs.usgs.gov/coupled/wphast
script:
- echo triggering phreeqc3-src
- curl -X POST -F token=${PHREEQC3_SRC_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${PHREEQC3_SRC_ID}/trigger/pipeline
- echo triggering wphast
- curl -X POST -F token=${WPHAST_TRIGGER} -F ref=master https://code.chs.usgs.gov/api/v4/projects/${WPHAST_ID}/trigger/pipeline
## Upstream Projects
## none