Skip to content

Commit

Permalink
ci: Added GitLab CI script for the Sandbox deployments (#31)
Browse files Browse the repository at this point in the history
Co-authored-by: Petr Jurak <petr.jurak@integsoft.cz>
  • Loading branch information
jurakp and Petr Jurak committed May 22, 2024
1 parent 875931e commit c70a9d6
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 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

0 comments on commit c70a9d6

Please sign in to comment.