diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e2632b9..345a9e0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,10 @@ image: geeksaccelerator/docker-library:golang1.12-docker services: - docker:dind +variables: + NO_BUILD: 'true' + NO_DEPLOY: 'true' + before_script: - 'cd ./tools/devops && make install && cd ../../' - 'cd ./tools/schema && make install && cd ../../' @@ -109,12 +113,12 @@ cache: HOST_NAMES: 'www.eproc.tech, api.eproc.tech' S3_BUCKET_PRIVATE: 'saas-starter-kit-private' S3_BUCKET_PUBLIC: 'saas-starter-kit-public' - NO_BUILD: 0 - NO_DEPLOY: 1 - AWS_USE_ROLE: 1 + AWS_USE_ROLE: 'true' webapi:build:dev: <<: *deploy_dev_webapi_tmpl stage: build:dev + variables: + NO_BUILD: 'false' only: - master - dev @@ -122,6 +126,8 @@ webapi:build:dev: webapi:deploy:dev: <<: *deploy_dev_webapi_tmpl stage: deploy:dev + variables: + NO_DEPLOY: 'false' dependencies: - 'webapi:build:dev' # - 'db:migrate:dev' diff --git a/tools/devops/cmd/deploy/service_deploy.go b/tools/devops/cmd/deploy/service_deploy.go index d75f458..5dea334 100644 --- a/tools/devops/cmd/deploy/service_deploy.go +++ b/tools/devops/cmd/deploy/service_deploy.go @@ -1558,6 +1558,22 @@ func ServiceDeploy(log *log.Logger, req *serviceDeployRequest) error { } } + // Ensure cache nodes are set after updating parameters. + if len(cacheCluster.CacheNodes) == 0 { + // Find Elastic Cache cluster given Id. + descRes, err := svc.DescribeCacheClusters(&elasticache.DescribeCacheClustersInput{ + CacheClusterId: req.CacheCluster.CacheClusterId, + ShowCacheNodeInfo: aws.Bool(true), + }) + if err != nil { + if aerr, ok := err.(awserr.Error); !ok || aerr.Code() != elasticache.ErrCodeCacheClusterNotFoundFault { + return errors.Wrapf(err, "Failed to describe cache cluster '%s'", *req.CacheCluster.CacheClusterId) + } + } else if len(descRes.CacheClusters) > 0 { + cacheCluster = descRes.CacheClusters[0] + } + } + log.Printf("\t%s\tDone setting up Cache Cluster '%s' successfully.\n", tests.Success, *cacheCluster.CacheClusterId) }