From 1ca8fec597ab8b611be3d17bea9b5188a7cf61da Mon Sep 17 00:00:00 2001 From: Gerald Manipon Date: Wed, 8 May 2019 09:19:05 -0700 Subject: [PATCH 1/7] use circleci workflows for test, docker build, and deploy to dockerhub - renamed "build" job to "test" and created "test" workflow - will run on all pull requests and merges into master - "build" job now builds isce docker container - "deploy" job will deploy docker image to dockerhub at isce/isce2 (https://cloud.docker.com/u/isce/repository/list) - need to configure DOCKER_PASS and DOCKER_USER in "Build Settings" -> "Envrionment Variables" on circleci - created "build-deploy" workflow to run "build" job then "deploy" job on merge of PR to master - created "build-periodically" workflow to run "build-periodically" job then "deploy" job once a week --- .circleci/config.yml | 114 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 111 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7732dd4..ff47213 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,6 @@ -version: 2 +version: 2.1 jobs: - build: + test: docker: - image: hysds/pge-base:latest user: root @@ -79,5 +79,113 @@ jobs: topsApp.py --help --steps stripmapApp.py --help --steps python3 -c "import isce" - + build: + docker: + - image: docker:stable-git + steps: + - checkout + - setup_remote_docker + - run: + name: Install dependencies + command: | + apk add --no-cache \ + python-dev py-pip bash pigz build-base libffi-dev openssl-dev + pip install \ + docker-compose awscli + - run: + name: Build + command: | + mkdir images + echo 'export TAG="$CIRCLE_SHA1"' >> images/env.sh + source images/env.sh + docker build --rm --force-rm -t isce/isce2:$TAG -f docker/Dockerfile . + cd images + docker save isce/isce2:$TAG > isce2.tar + - persist_to_workspace: + root: images + paths: + - "*" + build-periodically: + docker: + - image: docker:stable-git + steps: + - checkout + - setup_remote_docker + - run: + name: Install dependencies + command: | + apk add --no-cache \ + python-dev py-pip bash pigz build-base libffi-dev openssl-dev + pip install \ + docker-compose awscli + - run: + name: Build + command: | + mkdir images + echo 'export TAG=$(date -u +%Y%m%d)' >> images/env.sh + source images/env.sh + docker build --rm --force-rm -t isce/isce2:$TAG -f docker/Dockerfile . + cd images + docker save isce/isce2:$TAG > isce2.tar + - persist_to_workspace: + root: images + paths: + - "*" + deploy: + docker: + - image: alpine:latest + steps: + - run: + name: Install dependencies + command: | + apk add --no-cache \ + curl file + - attach_workspace: + at: images + - run: + name: Deploy + command: | + cd images + source env.sh + docker load -i isce2.tar + docker tag isce/isce2:$TAG isce/isce2:latest + docker login -u $DOCKER_USER -p $DOCKER_PASS + docker push isce/isce2:$TAG + docker push isce/isce2:latest +workflows: + version: 2 + test: + jobs: + - test + build-deploy: + jobs: + - build: + filters: + branches: + only: master + - deploy: + requires: + - build + filters: + branches: + only: master + weekly: + triggers: + - schedule: + cron: "0 7 * * 0" + filters: + branches: + only: + - master + jobs: + - build-periodically: + filters: + branches: + only: master + - deploy: + requires: + - build-periodically + filters: + branches: + only: master From bdae7a2c8ea857f2849b802a126a8f11556ac784 Mon Sep 17 00:00:00 2001 From: Gerald Manipon Date: Thu, 9 May 2019 18:20:49 +0000 Subject: [PATCH 2/7] use docker image --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ff47213..93a4382 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -133,7 +133,7 @@ jobs: - "*" deploy: docker: - - image: alpine:latest + - image: docker:stable-git steps: - run: name: Install dependencies From 0bd95e230d08711ff4b6819d5b69a2b302c4e993 Mon Sep 17 00:00:00 2001 From: Gerald Manipon Date: Thu, 9 May 2019 18:53:07 +0000 Subject: [PATCH 3/7] truncate CIRCLE_SHA1 to match github --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 93a4382..2be858e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -96,7 +96,8 @@ jobs: name: Build command: | mkdir images - echo 'export TAG="$CIRCLE_SHA1"' >> images/env.sh + SHA1=$(echo $CIRCLE_SHA1 | cut -c1-7) + echo 'export TAG="$SHA1"' >> images/env.sh source images/env.sh docker build --rm --force-rm -t isce/isce2:$TAG -f docker/Dockerfile . cd images From 6a441d0e8f601ef48936d695e6ef0543dc518a11 Mon Sep 17 00:00:00 2001 From: Gerald Manipon Date: Thu, 9 May 2019 18:56:07 +0000 Subject: [PATCH 4/7] setup remote docker --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2be858e..c9cdf14 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -136,6 +136,7 @@ jobs: docker: - image: docker:stable-git steps: + - setup_remote_docker - run: name: Install dependencies command: | From 1f96e8cdaf7ded135bf6fda97828575bfe301196 Mon Sep 17 00:00:00 2001 From: Gerald Manipon Date: Thu, 9 May 2019 20:09:28 +0000 Subject: [PATCH 5/7] set SHA1 correctly --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c9cdf14..057b5f1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -97,7 +97,7 @@ jobs: command: | mkdir images SHA1=$(echo $CIRCLE_SHA1 | cut -c1-7) - echo 'export TAG="$SHA1"' >> images/env.sh + echo "export TAG=$SHA1" >> images/env.sh source images/env.sh docker build --rm --force-rm -t isce/isce2:$TAG -f docker/Dockerfile . cd images From 6d94a9f54452c78074f7e950695637b5a81e8a26 Mon Sep 17 00:00:00 2001 From: Gerald Manipon Date: Thu, 9 May 2019 20:47:29 +0000 Subject: [PATCH 6/7] add build badge to README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index c57de73..b8984d9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # ISCE2 +[![CircleCI](https://circleci.com/gh/isce-framework/isce2.svg?style=svg)](https://circleci.com/gh/isce-framework/isce2) + This is the Interferometric synthetic aperture radar Scientific Computing Environment (ISCE). Its initial development was funded by NASA's Earth Science Technology Office (ESTO) under the Advanced Information Systems Technology From 16ee36e04faf8ab253f04e15a7316fbba7b0dd55 Mon Sep 17 00:00:00 2001 From: Gerald Manipon Date: Fri, 10 May 2019 14:30:22 +0000 Subject: [PATCH 7/7] more descriptive circleci job name --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 057b5f1..984216f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -93,7 +93,7 @@ jobs: pip install \ docker-compose awscli - run: - name: Build + name: Build docker image command: | mkdir images SHA1=$(echo $CIRCLE_SHA1 | cut -c1-7) @@ -120,7 +120,7 @@ jobs: pip install \ docker-compose awscli - run: - name: Build + name: Build docker image command: | mkdir images echo 'export TAG=$(date -u +%Y%m%d)' >> images/env.sh