The project provides an example of how to setup Twingate headless client in your Gitlab CI/CD Pipeline.
- Create Twingate service account key and assign resources to the service account based on your requirement
- Base64 encode the Twingate service account key. For example in Linux, execute the following command
echo '{"version": "1", "network": "xxxxx.twingate.com", "service_account_id": "xxxxx", "private_key": "-----BEGIN PRIVATE KEY-----\nxxxxx\n-----END PRIVATE KEY-----", "key_id": "xxxxx", "expires_at": "xxxxx", "login_path": "/api/v2/headless_node/login" }' | base64 -w 0
- Set the encoded service account key as Gitlab CI/CD variables
- Go to Setting
- CI/CD
- Variables -> Expand
- Add Variable (TWINGATE_SERVICE_ACCOUNT)
- Key: TWINGATE_SERVICE_ACCOUNT
- Value: encoded service account key
- Type: Variable
- Environment Scope: Based on your requirement
- Protect Variable: recommend setting to true
- Mask Variable: recommend setting to true
- Copy the sections
before_script
from.gitlab-ci.yml
- Confirm the valid response is returned by the resource in the CI/CD logs
If you are running your own Gitlab Runner, the privileged mode is required.