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

ARROW-6260: [Website] Use deploy key on Travis to build and push to asf-site #16

Merged
merged 5 commits into from Aug 22, 2019

Conversation

nealrichardson
Copy link
Member

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 the asf-site branch.

Copy link
Member

@kou kou left a 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.

echo "https://travis-ci.org/${TRAVIS_REPO_SLUG}/settings"
exit 1
fi

if [ "${DEPLOY_KEY}" != "" ]; then
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! Done, PTAL.

/g' scripts/deploy_key
chmod 600 scripts/deploy_key
eval $(ssh-agent -s)
ssh-add scripts/deploy_key
Copy link
Member

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 -

Copy link
Member Author

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

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 -
Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Seems to work.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the try!

Copy link
Member Author

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants