-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
52 lines (48 loc) · 1.89 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# GitLab CI configuration file
# INTEGSOFT_DOCKER_IMAGE and DOCKER_IMAGE_VERSION_PR are defined on the Gitlab settings page.
stages:
- push
variables:
STORAGE_DRIVER: vfs
BUILDAH_FORMAT: docker
push_integsoft:
stage: push
only:
refs:
- merge_requests
variables:
- $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "integsoft"
image:
name: noenv/buildah
entrypoint: ['']
variables:
DOCKER_INTEGSOFT_IMAGE: "$INTEGSOFT_DOCKER_REGISTRY/$INTEGSOFT_DOCKER_IMAGE:$DOCKER_IMAGE_VERSION_PR"
DOCKER_INTEGSOFT_IMAGE_LATEST: "$INTEGSOFT_DOCKER_REGISTRY/$INTEGSOFT_DOCKER_IMAGE:latest"
script:
- echo "Preparing Integsoft MBTA Keycloak Docker image release..."
- buildah bud --no-cache -t $DOCKER_INTEGSOFT_IMAGE -t $DOCKER_INTEGSOFT_IMAGE_LATEST .
- buildah push --tls-verify=false $DOCKER_INTEGSOFT_IMAGE
- buildah push --tls-verify=false $DOCKER_INTEGSOFT_IMAGE_LATEST
push_aws:
stage: push
only:
- tags
image:
name: noenv/buildah
entrypoint: ['']
variables:
DOCKER_INTEGSOFT_IMAGE: "$INTEGSOFT_DOCKER_REGISTRY/$INTEGSOFT_DOCKER_IMAGE:$DOCKER_IMAGE_VERSION_TAGGED"
DOCKER_AWS_IMAGE: "$ECR_DOCKER_REGISTRY/$ECR_DOCKER_IMAGE:$DOCKER_IMAGE_VERSION_TAGGED"
DOCKER_AWS_IMAGE_LATEST: "$ECR_DOCKER_REGISTRY/$ECR_DOCKER_IMAGE:latest"
before_script:
- dnf install -y awscli
- aws --version
script:
- echo "Preparing AWS ECR MBTA Keycloak Docker image release..."
- buildah pull --tls-verify=false $DOCKER_INTEGSOFT_IMAGE
- buildah tag $DOCKER_INTEGSOFT_IMAGE $DOCKER_AWS_IMAGE
- buildah tag $DOCKER_INTEGSOFT_IMAGE $DOCKER_AWS_IMAGE_LATEST
- aws ecr get-login-password | buildah login --username AWS --password-stdin $ECR_DOCKER_REGISTRY
- buildah push $DOCKER_AWS_IMAGE
- buildah push $DOCKER_AWS_IMAGE_LATEST
- aws ecs update-service --cluster $ECS_CLUSTER_NAME --service $ECS_SERVICE_NAME --force-new-deployment