Difference between revisions of "Gitlab CI/CD"
Jump to navigation
Jump to search
imported>Jeremy-busk |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 12: | Line 12: | ||
if [ "$(git diff origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}...HEAD --name-only dir1 dir2 dir3" == "" ]; then echo "Skipped" && exit 0; fi | if [ "$(git diff origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}...HEAD --name-only dir1 dir2 dir3" == "" ]; then echo "Skipped" && exit 0; fi | ||
+ | |||
+ | |||
+ | # Self-Signed Certs with Runners | ||
+ | ``` | ||
+ | SERVER=git.example.io | ||
+ | PORT=443 | ||
+ | CERTIFICATE=/etc/gitlab-runner/certs/${SERVER}.crt | ||
+ | |||
+ | # Create the certificates hierarchy expected by gitlab | ||
+ | sudo mkdir -p $(dirname "$CERTIFICATE") | ||
+ | |||
+ | # Get the certificate in PEM format and store it | ||
+ | openssl s_client -connect ${SERVER}:${PORT} -showcerts </dev/null 2>/dev/null | sed -e '/-----BEGIN/,/-----END/!d' | sudo tee "$CERTIFICATE" >/dev/null | ||
+ | echo $CERTIFICATE | ||
+ | # Register your runner | ||
+ | gitlab-runner register --tls-ca-file="$CERTIFICATE" | ||
+ | ``` | ||
+ | or add to existing | ||
+ | ``` | ||
+ | [[runners]] | ||
+ | tls-ca-file = "/etc/gitlab-runner/certs/git.example.io.crt" | ||
+ | ... | ||
+ | ``` |
Latest revision as of 18:01, 7 August 2020
Using LXD/PyLXD with Gitlab
On you lxd-runner add gitlab-runner user to lxd group so it can spin up lxd containers.
sudo usermod --append --groups lxd gitlab-runner
Run only with changes on directory
https://docs.gitlab.com/ee/ci/yaml/#onlychanges-and-exceptchanges
or do some custom script
if [ "$(git diff origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}...HEAD --name-only dir1 dir2 dir3" == "" ]; then echo "Skipped" && exit 0; fi
Self-Signed Certs with Runners
SERVER=git.example.io PORT=443 CERTIFICATE=/etc/gitlab-runner/certs/${SERVER}.crt # Create the certificates hierarchy expected by gitlab sudo mkdir -p $(dirname "$CERTIFICATE") # Get the certificate in PEM format and store it openssl s_client -connect ${SERVER}:${PORT} -showcerts </dev/null 2>/dev/null | sed -e '/-----BEGIN/,/-----END/!d' | sudo tee "$CERTIFICATE" >/dev/null echo $CERTIFICATE # Register your runner gitlab-runner register --tls-ca-file="$CERTIFICATE"
or add to existing
[[runners]] tls-ca-file = "/etc/gitlab-runner/certs/git.example.io.crt" ...