-
Gruntwork code shows examples of using hosted github, bitbucket and gitlab. I have a self-hosted gitlab instance within my organization, and I need step-by-step guidance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Using self-hosted gitlabIn this article, we cover steps necessary to use a self-hosted gitlab instance with Gruntwork's Obtain and store Gitlab Personal Access TokenWe will use gitlab PAT to authenticate with gitlab. Instructions for creating PAT are here: https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html AWS Secrets Manager is ideal for storing the token, as it offers encryption, granular access policies, ability to rotate secrets, audit trail and versioning. Create a secret and copy the secret's ARN. Add gitlab settings to terraform-helper moduleIn terraform-update-variable script, start with the variable declarations section in
In the case block just below declarations, add the parameter --self-hosted-gitlab-token-secrets-manager-arn)
self_hosted_gitlab_token_secrets_manager_arn="$2"
shift
;; Little further down in the module, add gitlab authentication config_https_auth_from_secrets_manager '[mygitlab.example.com](http://mygitlab.example.com/)' 'oauth2' "$self_hosted_gitlab_token_secrets_manager_arn" Add token to infrastructure-deploy-scriptIn the main function, add a new environment variable to hold the PATself_hosted_gitlab_auth_token = os.environ.get(f'{ENVVAR_PREFIX}_SELF_HOSTED_GITLAB_TOKEN', None) In the token block, add the token if self_hosted_gitlab_auth_token is not None:
git.configure_https_auth('oauth2', self_hosted_gitlab_auth_token, '[mygitlab.example.com](http://mygitlab.example.com/)') In the configure_force_https function, add gitlab urlfor host in ['[github.com](http://github.com/)', '[gitlab.com](http://gitlab.com/)', '[bitbucket.org](http://bitbucket.org/)', '[mygitlab.example.com](http://mygitlab.example.com/)]: |
Beta Was this translation helpful? Give feedback.
Using self-hosted gitlab
In this article, we cover steps necessary to use a self-hosted gitlab instance with Gruntwork's
terraform-aws-ci
repo.Obtain and store Gitlab Personal Access Token
We will use gitlab PAT to authenticate with gitlab. Instructions for creating PAT are here: https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html
AWS Secrets Manager is ideal for storing the token, as it offers encryption, granular access policies, ability to rotate secrets, audit trail and versioning.
Create a secret and copy the secret's ARN.
Add gitlab settings to terraform-helper module
In terraform-update-variable script, start with the variable declarations section in
run_update
fun…