Skip to content

Instantly share code, notes, and snippets.

@fredleger
Created April 23, 2020 10:07
Show Gist options
  • Save fredleger/d87b0af3e8c68c1f011e39b112cda9fb to your computer and use it in GitHub Desktop.
Save fredleger/d87b0af3e8c68c1f011e39b112cda9fb to your computer and use it in GitHub Desktop.
Local CI/CD with Gitlab
SSH_PRIVATE_KEY="xxxxxxxxx - redacted base64 content --- xxxxxxxxx"
AWS_DEFAULT_REGION="eu-west-3"
AWS_ACCESS_KEY_ID="redacted"
AWS_SECRET_ACCESS_KEY="redacted"
#!/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