From fe8e9c2759e35e93d4a9bb12c5fa9070d1310628 Mon Sep 17 00:00:00 2001
From: Sylvester Joosten <sjoosten@anl.gov>
Date: Fri, 24 Jul 2020 22:43:12 -0500
Subject: [PATCH] updated CI to have develop and release modes

---
 .gitlab-ci.yml              | 32 +++++++++++++++++++++++++++++---
 containers/release/Makefile | 10 ++++++++++
 2 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e1e2745d2..c6c1300d3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -5,25 +5,51 @@ stages:
   - phase2
   - phase3
 
-eic_builder_docker:
+eic_builder_release:
   stage: phase1
   tags:
      - sodium dind
+  only:
+     - tags
+     - master
+  script:
+     - cd containers/builder
+     - head Dockerfile
+     - make login
+     - make release-cached
+eic_builder_develop:
+  stage: phase1
+  tags:
+     - sodium dind
+  only:
+     - develop
   script:
      - cd containers/builder
      - head Dockerfile
      - make login
      - make develop-cached
 
-eic_docker:
+eic_release:
   stage: phase2
   tags:
      - sodium dind
-  when: manual
+  only:
+     - tags
+     - master
   script:
      - cd containers/release
      - make login
      - make release-cached
+eic_develop:
+  stage: phase2
+  tags:
+     - sodium dind
+  only:
+     - develop
+  script:
+     - cd containers/release
+     - make login
+     - make develop-cached
 
 eic_builder_singularity:
   stage: phase2
diff --git a/containers/release/Makefile b/containers/release/Makefile
index e66f3dffb..53a827dbc 100644
--- a/containers/release/Makefile
+++ b/containers/release/Makefile
@@ -81,7 +81,12 @@ release: build-nc publish ## Make a release by building and publishing the `{ver
 	@echo "Cleaning up"
 	docker rmi $(APP_NAME):latest
 
+develop: build-nc publish-dev ## Develop build, do not publish latest
+	@echo "Cleaning up"
+	docker rmi $(APP_NAME):unstable
+
 release-cached: build publish ## Make a release by building and publishing the `{version}` ans `latest` tagged containers to ECR
+develop-cached: build login publish-dev ## develop release
 
 publish: login publish-latest publish-version #publish-version ## Publish the `{version}` ans `latest` tagged containers to ECR
 	@echo "Publishing done"
@@ -93,6 +98,11 @@ publish-latest: ## Publish the `latest` taged container to ECR
 	docker push $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):latest
 	#docker rmi  $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):latest
 
+publish-dev: ## Publish the `unstable` taged container to ECR
+	@echo 'publish unstable to $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME)'
+	docker tag $(APP_NAME):latest $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):unstable
+	docker push $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):unstable
+
 publish-version: tag-version ## Publish the `{version}` taged container to ECR
 	@echo 'publish latest to $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):$(VERSION)'
 	docker tag $(APP_NAME):latest $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):$(VERSION)
-- 
GitLab