-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update circleci to 2.1 api and fix dockerfile (#53)
* update Dockerfile so it will build * update circleci to 2.1 api * fix config * fix circle * no_output_timeout instead of timeout * remove double commas from substitution * change to machine images * fix license file * fix license * fix load docker image * update cache * split test_data cache from docker cache * fix remove colons? * move data loading to test * add checkout to test * save test_data cache * fix save cache * FIX use tmpfs instead of mounting tmp * add filter entries for build and test * FIX deploy * FIX restore_cache key
- Loading branch information
1 parent
753bd76
commit 3a65466
Showing
3 changed files
with
124 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
version: 2.1 | ||
jobs: | ||
build: | ||
machine: | ||
image: circleci/classic:latest | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- v_0-image_cache-{{ checksum "Dockerfile" }} | ||
- run: | ||
name: load and build | ||
command: | | ||
if [[ -e ~/docker/image.tar ]]; then docker load -i ~/docker/image.tar; fi | ||
git describe --tags > version | ||
docker build -t bids/${CIRCLE_PROJECT_REPONAME} . | ||
mkdir -p ~/docker; docker save "bids/${CIRCLE_PROJECT_REPONAME}" > ~/docker/image.tar | ||
mkdir -p ~/license; echo "cHJpbnRmICJEeWxhbi5OaWVsc29uQGdtYWlsLmNvbVxuMzcwNjNcbiAqQ1lrZWhQYUNvRDlNXG4gRlM2N1BTWmRFV2lqb1xuIiA+IH4vbGljZW5zZS9saWNlbnNlLnR4dA==" | base64 -d | sh | ||
no_output_timeout: 6h | ||
- save_cache: | ||
key: v_0-image_cache-{{ checksum "Dockerfile" }}-{{ .Revision }}-{{ epoch }} | ||
paths: | ||
- ~/docker | ||
- ~/license | ||
test: | ||
machine: | ||
image: circleci/classic:latest | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
key: v_0-image_cache-{{ checksum "Dockerfile" }}-{{ .Revision }} | ||
- restore_cache: | ||
key: v_0-test_data | ||
- run: | ||
name: get data | ||
command: | | ||
if [[ ! -d ~/data/ds114_test1 ]]; then wget -c -O ${HOME}/ds114_test1.tar "https://files.osf.io/v1/resources/9q7dv/providers/osfstorage/57e54a326c613b01d7d3ed90" && mkdir -p ${HOME}/data && tar xf ${HOME}/ds114_test1.tar -C ${HOME}/data; fi | ||
if [[ ! -d ~/data/ds114_test2 ]]; then wget -c -O ${HOME}/ds114_test2.tar "https://files.osf.io/v1/resources/9q7dv/providers/osfstorage/57e549f9b83f6901d457d162" && mkdir -p ${HOME}/data && tar xf ${HOME}/ds114_test2.tar -C ${HOME}/data; fi | ||
if [[ ! -d ~/data/ds114_test1_freesurfer_precomp_v6.0.0 ]]; then wget -c --no-check-certificate -O ${HOME}/ds114_test1_freesurfer_precomp_v6.0.0.tar "https://osf.io/j6zk2/?action=download&version=1" && mkdir -p ${HOME}/data && tar xf ${HOME}/ds114_test1_freesurfer_precomp_v6.0.0.tar -C ${HOME}/data; fi | ||
if [[ ! -d ~/data/ds114_test2_freesurfer_precomp_v6.0.0 ]]; then wget -c --no-check-certificate -O ${HOME}/ds114_test2_freesurfer_precomp_v6.0.0.tar "https://osf.io/yhzzj/?action=download&version=1" && mkdir -p ${HOME}/data && tar xf ${HOME}/ds114_test2_freesurfer_precomp_v6.0.0.tar -C ${HOME}/data; fi | ||
- save_cache: | ||
key: v_0-test_data | ||
paths: | ||
- ~/data | ||
- run: | ||
name: load image | ||
command: docker load -i ~/docker/image.tar | ||
- run: | ||
name: print version | ||
command: | | ||
docker run -ti --rm --read-only -v ~/license/license.txt:/license.txt --tmpfs /tmp --tmpfs /var/tmp -v $PWD/ds114_test1:/bids_dataset bids/${CIRCLE_PROJECT_REPONAME} --version | ||
docker run -ti --rm --read-only -v ~/license/license.txt:/license.txt --tmpfs /tmp --tmpfs /var/tmp -v ${HOME}/data/ds114_test1:/bids_dataset bids/${CIRCLE_PROJECT_REPONAME} -h | ||
- run: | ||
name: test 1 | ||
command: | | ||
docker run -ti --rm --read-only -v ~/license/license.txt:/license.txt --tmpfs /tmp --tmpfs /var/tmp -v ${HOME}/data/ds114_test1:/bids_dataset -v ${HOME}/outputs1:/outputs bids/${CIRCLE_PROJECT_REPONAME} /bids_dataset /outputs participant --participant_label 01 --license_file=/license.txt --stages autorecon1 && cat ${HOME}/outputs1/sub-01/scripts/recon-all.done | ||
no_output_timeout: 6h | ||
- run: | ||
name: test 2 | ||
command: | | ||
docker run -ti --rm --read-only -v ~/license/license.txt:/license.txt --tmpfs /tmp --tmpfs /var/tmp -v ${HOME}/data/ds114_test2:/bids_dataset -v ${HOME}/outputs2:/outputs bids/${CIRCLE_PROJECT_REPONAME} /bids_dataset /outputs participant --participant_label 01 --steps cross-sectional --session_label test --license_file=/license.txt --stages autorecon1 && cat ${HOME}/outputs2/sub-01_ses-test/scripts/recon-all.done | ||
no_output_timeout: 6h | ||
- run: | ||
name: group2 test 1 | ||
command: | | ||
docker run -ti --rm --read-only -v ~/license/license.txt:/license.txt --tmpfs /tmp --tmpfs /var/tmp -v ${HOME}/data/ds114_test1:/bids_dataset -v ${HOME}/data/ds114_test1_freesurfer_precomp_v6.0.0:/outputs bids/${CIRCLE_PROJECT_REPONAME} /bids_dataset /outputs group2 --license_file=/license.txt && mkdir -p ${HOME}/outputs1/ && sudo mv ${HOME}/data/ds114_test1_freesurfer_precomp_v6.0.0/00_group* ${HOME}/outputs1/ && cat ${HOME}/outputs1/00_group2_stats_tables/lh.aparc.thickness.tsv && cat ${HOME}/outputs1/00_group2_stats_tables/euler.tsv | ||
no_output_timeout: 6h | ||
- run: | ||
name: group2 test 2 | ||
command: | | ||
docker run -ti --rm --read-only -v ~/license/license.txt:/license.txt --tmpfs /tmp --tmpfs /var/tmp -v ${HOME}/data/ds114_test2:/bids_dataset -v ${HOME}/data/ds114_test2_freesurfer_precomp_v6.0.0:/outputs bids/${CIRCLE_PROJECT_REPONAME} /bids_dataset /outputs group2 --license_file=/license.txt && mkdir -p ${HOME}/outputs2/ && sudo mv ${HOME}/data/ds114_test2_freesurfer_precomp_v6.0.0/00_group* ${HOME}/outputs2/ && cat ${HOME}/outputs2/00_group2_stats_tables/lh.aparc.thickness.tsv && cat ${HOME}/outputs2/00_group2_stats_tables/euler.tsv | ||
no_output_timeout: 6h | ||
- store_artifacts: | ||
path: ~/outputs1 | ||
- store_artifacts: | ||
path: ~/outputs2 | ||
|
||
|
||
deploy: | ||
machine: | ||
image: circleci/classic:latest | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
key: v_0-image_cache-{{ checksum "Dockerfile" }}-{{ .Revision }} | ||
- run: | ||
name: load image | ||
command: docker load -i ~/docker/image.tar | ||
- deploy: | ||
command: | | ||
if [[ -n "$DOCKER_PASS" ]]; then docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS && docker push bids/${CIRCLE_PROJECT_REPONAME}:latest; fi | ||
if [[ -n "$DOCKER_PASS" ]]; then docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS && docker tag bids/${CIRCLE_PROJECT_REPONAME} bids/${CIRCLE_PROJECT_REPONAME}:$CIRCLE_TAG && docker push bids/${CIRCLE_PROJECT_REPONAME}:$CIRCLE_TAG; fi | ||
no_output_timeout: 6h | ||
|
||
workflows: | ||
version: 2.1 | ||
build_test_deploy: | ||
jobs: | ||
- build: | ||
filters: | ||
tags: | ||
only: /.*/ | ||
branches: | ||
only: /.*/ | ||
- test: | ||
requires: | ||
- build | ||
filters: | ||
tags: | ||
only: /.*/ | ||
branches: | ||
only: /.*/ | ||
- deploy: | ||
requires: | ||
- build | ||
- test | ||
filters: | ||
branches: | ||
ignore: /.*/ | ||
tags: | ||
only: /.*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.