Skip to content

Instantly share code, notes, and snippets.

@wickedev
Created October 15, 2020 04:07
Show Gist options
  • Save wickedev/0ec9b6df789aabec8126e109f56b28f0 to your computer and use it in GitHub Desktop.
Save wickedev/0ec9b6df789aabec8126e109f56b28f0 to your computer and use it in GitHub Desktop.
#!/bin/bash
gitlab_ci () {
gitlab-runner exec docker "$1" \
--cache-dir=/tmp/gitlab-cache \
--docker-cache-dir=/tmp/gitlab-cache \
--docker-volumes=/tmp/gitlab-cache \
--docker-volumes="$PWD"/deploy:/deploy \
--env=DOCKER_CONFIG_JSON=/deploy/config.json \
--env=DEPLOY_KUBECONFIG=/deploy/kubeconfig \
--env=CI_REGISTRY_IMAGE=harbor.blah.co.kr/blah/web \
--env=CI_COMMIT_SHORT_SHA=local-"$(git_hash)"
}
git_hash() {
git rev-parse --short=8 HEAD
}
gitlab_ci "test"
gitlab_ci "build"
gitlab_ci "push image"
gitlab_ci "deploy"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment