Note: Repeat the required steps/checks below for all repositories as needed
- Create the GitLab repository if not done yet
| #!/bin/bash | |
| echo "Retrieving session tokens" | |
| tokens=$(aws sts assume-role --role-arn arn:aws:iam::123456789012:role/ExampleRole --role-session-name TempSession) | |
| echo "Exporting credentials to env variables..." | |
| export AWS_ACCESS_KEY_ID=$(echo $tokens | jq -r .Credentials.AccessKeyId) | |
| export AWS_SECRET_ACCESS_KEY=$(echo $tokens | jq -r .Credentials.SecretAccessKey) | |
| export AWS_SESSION_TOKEN=$(echo $tokens | jq -r .Credentials.SessionToken) | |
| echo "Successfully exported credentials..." |
| #!/bin/sh | |
| echo "Attempting to setup git credentials..." | |
| git config --global credential.helper store | |
| git config --global user.email "$GITLAB_USER_EMAIL" | |
| git config --global user.name "$GITLAB_USER_NAME" | |
| echo "https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com" > ~/.git-credentials | |
| echo "Git credentials set..." |