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

Change CI behavior when MANUBOT_SSH_PRIVATE_KEY is unset #302

Merged
merged 7 commits into from
Jan 19, 2020

Conversation

dhimmel
Copy link
Member

@dhimmel dhimmel commented Jan 17, 2020

Not sure yet which parts of this we want to keep

Copy link
Member

@agitter agitter left a comment

Choose a reason for hiding this comment

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

Would you like to add the three BUILD environment variables to .appveyor.yml as well? The AppVeyor build assumes we build HTML and PDF and not DOCX due to the artifacts it saves.

@@ -35,15 +35,9 @@ set +o xtrace # disable xtrace in subshell for private key operations
if [ -v MANUBOT_SSH_PRIVATE_KEY ]; then
base64 --decode <<< "$MANUBOT_SSH_PRIVATE_KEY" | ssh-add -
else
echo "DeprecationWarning: Loading deploy.key from an encrypted file.
Copy link
Member

Choose a reason for hiding this comment

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

This the only change I'm not completely sure about. It is probably safe to drop support for the deprecated deploy.key now.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd love to get rid of it, but there's no need with the current way we're doing the conditionality.

.travis.yml Outdated
skip_cleanup: true
on:
branch: master
condition: $TRAVIS_EVENT_TYPE = "push"
condition: $TRAVIS_EVENT_TYPE = "push" && -v MANUBOT_SSH_PRIVATE_KEY
Copy link
Member

Choose a reason for hiding this comment

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

Should we add a similar condition to GitHub Actions? We wouldn't recommend enabling GitHub Actions and Travis CI and setting the private key only for Travis, but someone could do that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea. This way we can continue supporting the encrypted file travis deploy keys.

Copy link
Member Author

Choose a reason for hiding this comment

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

Wait actually this breaks the deploy for travis users still using the old method, because MANUBOT_SSH_PRIVATE_KEY is unset for them. Hmm not sure what to do.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, right. I had the logic mixed up.

ci/deploy.sh Outdated Show resolved Hide resolved
@@ -36,4 +36,10 @@ jobs:
MANUBOT_SSH_PRIVATE_KEY: ${{ secrets.MANUBOT_SSH_PRIVATE_KEY }}
BUILD_WEB_URL: https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks
shell: bash --login {0}
run: bash ci/deploy.sh
run: |
if [ "$MANUBOT_SSH_PRIVATE_KEY" != "" ]; then
Copy link
Member Author

Choose a reason for hiding this comment

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

This would be better in an if expression for the step, but I couldn't figure out how to do that.
https://github.community/t5/GitHub-Actions/If-expression-with-context-variable/m-p/34560/highlight/true#M1959

@dhimmel dhimmel merged commit eab9b2a into manubot:master Jan 19, 2020
@dhimmel dhimmel deleted the envvar-config branch January 19, 2020 00:26
@dhimmel
Copy link
Member Author

dhimmel commented Jan 19, 2020

Travis is working after fixup in f6b6231

Failure in https://travis-ci.com/manubot/rootstock/builds/145088017#L2183 expected, because I hadn't deleted the legacy encrypted_* env vars.

ploegieku added a commit to ploegieku/2023-functional-homology-paper that referenced this pull request Aug 6, 2024
merges manubot/rootstock#302

GitHub Actions: do not run deploy.sh if secrets.MANUBOT_SSH_PRIVATE_KEY
is not set resulting in `env: MANUBOT_SSH_PRIVATE_KEY: ""`
https://github.community/t5/GitHub-Actions/If-expression-with-context-variable/m-p/34560/highlight/true#M1959

Travis CI: condition deploy on MANUBOT_SSH_PRIVATE_KEY being set
or variable name expansion for encrypted_*.
https://unix.stackexchange.com/a/290296/294987
https://wiki.bash-hackers.org/syntax/pe#variable_name_expansion
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.

2 participants