Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rootfs/usr/local/bin/git-credential-github. Update rootfs/etc/init.d/atlantis.sh to use git-credential-github #476

Merged
merged 2 commits into from
May 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
build-harness/
aws-assumed-role/
.idea/
*.iml
7 changes: 7 additions & 0 deletions rootfs/etc/init.d/atlantis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ if [ "${ATLANTIS_ENABLED}" == "true" ]; then
# Do not export these as Terraform environment variables
export TFENV_BLACKLIST="^(AWS_ACCESS_KEY_ID|AWS_SECRET_ACCESS_KEY|AWS_SECURITY_TOKEN|AWS_SESSION_TOKEN|ATLANTIS_.*|GITHUB_.*)$"

# Configure Git credentials for atlantis to allow access to GitHub private repos (see rootfs/usr/local/bin/git-credential-github)
# https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage
export GITHUB_USER=${ATLANTIS_GH_USER}
export GITHUB_TOKEN=${ATLANTIS_GH_TOKEN}
chmod +x /usr/local/bin/git-credential-github
git config --global credential.helper 'github'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the name of the helper should be the script name, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's the last part after git-credential-
https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage


# Use a primitive init handler to catch signals and handle them properly
# Use gosu to drop privileges
# Use env to setup the shell environment for atlantis
Expand Down
8 changes: 8 additions & 0 deletions rootfs/usr/local/bin/git-credential-github
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

# https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage

echo protocol=https
echo host=github.com
echo username="${GITHUB_USER}"
echo password="${GITHUB_TOKEN}"