-
-
Save fredleger/d87b0af3e8c68c1f011e39b112cda9fb to your computer and use it in GitHub Desktop.
Local CI/CD with Gitlab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SSH_PRIVATE_KEY="xxxxxxxxx - redacted base64 content --- xxxxxxxxx" | |
AWS_DEFAULT_REGION="eu-west-3" | |
AWS_ACCESS_KEY_ID="redacted" | |
AWS_SECRET_ACCESS_KEY="redacted" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CI_STEP="${1:-build}" | |
echo "+ running gitlab-runner" | |
gitlab-runner exec docker \ | |
--docker-privileged \ | |
--env CI_PIPELINE_ID="0000" \ | |
--env CI_COMMIT_SHA1="$(git rev-parse --short HEAD)" \ | |
--env CI_COMMIT_TAG="local-ci" \ | |
--env SSH_PRIVATE_KEY="$(echo ${SSH_PRIVATE_KEY} | base64 --decode)" \ | |
--env AWS_DEFAULT_REGION="${AWS_DEFAULT_REGION}" \ | |
--env AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID}" \ | |
--env AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY}" \ | |
--cache-dir=/tmp/gitlab-cache \ | |
--docker-cache-dir=/tmp/gitlab-cache \ | |
--docker-volumes=/tmp/gitlab-cache \ | |
"${CI_STEP}" | |
echo "+ finished (${?:-999})" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment