This is my first experience with gitlab. I need to create additional branches for the "service" project: test, stage, and prod. ECR, ECS, and Task Definition should be dedicated to each environment, as well as ECS clusters. I have a master branch and I add variables in child settings. Do I need to add all the variables there or prescribe each variable in the YAML file? I have requirements:
- Build stage:
- tagging must include hash_sum (only commitID must be selected) and 'latest' keyword
- keep artifact to use it on second step
- Push stage:
- use aws cli to push image into appropriate repository (dedicated ECR repos for every service)
- Deploy stage:
- Check if the previous revision of TD running , if so, stop the task first, then deploy a new revision
- Parse the deploy output:
- leave only TD name and IP address in the deploy output.
script:
- docker build -t $CI_AWS_ECR_SERVICE/$REPOSITORY_NAME:$CI_COMMIT_SHORT_SHA .
- docker save -o my-artifact.tar $CI_AWS_ECR_SERVICE/$REPOSITORY_NAME:$CI_COMMIT_SHORT_SHA
artifacts:
paths:
- my-artifact.tar
- echo "Logging in to Amazon ECR..."
- aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
- aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
- aws configure set region $AWS_DEFAULT_REGION
- aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $CI_AWS_ECR_SERVICE
- docker load -i my-artifact.tar
- docker tag $CI_AWS_ECR_SERVICE/$REPOSITORY_NAME:$CI_COMMIT_SHORT_SHA $CI_AWS_ECR_SERVICE/$REPOSITORY_NAME:$CI_COMMIT_SHA
- docker push $CI_AWS_ECR_SERVICE/$REPOSITORY_NAME:latest
# - echo "Logging in to Amazon ECS and update service..."
# - aws ecs update-service --cluster $CI_AWS_ECS_CLUSTER --service $CI_AWS_ECS_SERVICE --force-new-deployment --desired-count 1 --region $AWS_DEFAULT_REGION
- aws ecs describe-task-definition --task-definition $CI_AWS_ECS_TASK_DEFINITION --output json --query taskDefinition > task-definition.json
- python replace-container-defn-img.py task-definition.json $CI_AWS_ECR_SERVICE/$REPOSITORY_NAME:latest
- aws ecs register-task-definition --cli-input-json file://task-definition.json
- aws ecs update-service --cluster $CI_AWS_ECS_CLUSTER --service $CI_AWS_ECS_SERVICE --task-definition $CI_AWS_ECS_TASK_DEFINITION --force-new-deployment --desired-count 1 --region $AWS_DEFAULT_REGION
all these variables from the master branch, how can i add variables from other branches?