Difference between revisions of "Gitlab CI/CD"
Jump to navigation
Jump to search
Line 16: | Line 16: | ||
# Self-Signed Certs with Runners | # Self-Signed Certs with Runners | ||
``` | ``` | ||
− | SERVER=git. | + | SERVER=git.example.io |
PORT=443 | PORT=443 | ||
CERTIFICATE=/etc/gitlab-runner/certs/${SERVER}.crt | CERTIFICATE=/etc/gitlab-runner/certs/${SERVER}.crt |
Revision as of 17:58, 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"