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
ARROW-6260: [Website] Use deploy key on Travis to build and push to asf-site #16
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
I left some comments.
build-and-deploy.sh
Outdated
echo "https://travis-ci.org/${TRAVIS_REPO_SLUG}/settings" | ||
exit 1 | ||
fi | ||
|
||
if [ "${DEPLOY_KEY}" != "" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use one of -z "..."
style or "..." != ""
style in this script for consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Done, PTAL.
build-and-deploy.sh
Outdated
/g' scripts/deploy_key | ||
chmod 600 scripts/deploy_key | ||
eval $(ssh-agent -s) | ||
ssh-add scripts/deploy_key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use ssh-add -
here:
echo "${DEPLOY_KEY}" | sed -e 's/\\n/\n/g' | ssh-add -
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, nice to avoid making that file
build-and-deploy.sh
Outdated
eval $(ssh-agent -s) | ||
# Hack to make the key from the env var have real newlines | ||
echo "${DEPLOY_KEY}" | sed -e 's/\\n/\ | ||
/g' | ssh-add - |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use s/\\n/\n/g
here?
It works well with bash on my Debian GNU/Linux:
#!/bin/bash
DEPLOY_KEY="-----BEGIN\ OPENSSH\ PRIVATE\ KEY-----\\naaa\\nbbb"
echo "${DEPLOY_KEY}"
echo "${DEPLOY_KEY}" | sed -e 's/\\n/\n/g'
$ /tmp/a.sh
-----BEGIN\ OPENSSH\ PRIVATE\ KEY-----\naaa\nbbb
-----BEGIN\ OPENSSH\ PRIVATE\ KEY-----
aaa
bbb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't work on my mac but it doesn't have to as long as it works on Travis ;)
I'll give it a shot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the try!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for always managing to teach me a new bash trick :)
This change enables the use of GitHub deploy keys, which are tied to a repository and not an individual (in contrast with personal access tokens). Once this is merged, we can add a key pair to the repository settings in GitHub and Travis (INFRA may be required to do one or both of those) and then commits to the website source in the
master
branch will automatically build and push the generated static site to theasf-site
branch.