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
Fix a few bugs with the changelog creation script #13020
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
cfafe95
Fix a few bugs with the changelog creation script
Hamms adc0ad7
add run_on helper to deal with nested quotes in ssh commands
Hamms 615ec7f
allow levelbuilder content commits to show up in changelog
Hamms 5eb1f49
use String.inspect to properly escape ssh command string
Hamms File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,13 +68,19 @@ def open_in_default_browser(url) | |
end | ||
end | ||
|
||
def run_on(server_name, command) | ||
# escape any double quotes in the command string | ||
command = %Q["#{command}"] | ||
system "ssh -t gateway.code.org ssh -t #{server_name} \"#{command}\"" | ||
end | ||
|
||
def content_push(server_name, environment_name, user_name) | ||
puts <<-EOS.unindent | ||
Follow the prompts given by the content-push script. | ||
If you need to do something fancier (or if the changed files do not | ||
"look ok" when it asks you), log in to staging and hand-craft the commit. | ||
EOS | ||
success = system "ssh -t gateway.code.org ssh -t #{server_name} \"#{environment_name}/bin/content-push --name=\\\"#{user_name}\\\"\"" | ||
success = run_on(server_name, "#{environment_name}/bin/content-push --name=\"#{user_name}\"") | ||
|
||
# Notice if the content push fails, and be helpful about fixing the problem. | ||
unless success | ||
|
@@ -167,7 +173,7 @@ should_i "DTP" do | |
|
||
should_i "create a new release of the code-dot-org repository on github" do | ||
wait_for "the production server to fetch the latest changes" | ||
system "ssh -t gateway.code.org ssh -t production-daemon \"production/bin/create-release\"" | ||
run_on("production-daemon", "cd production; ./bin/create-release") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
end | ||
|
||
wait_for "DTP to finish" | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Does ruby implicitly handle escaping pre-escaped quotes when it interpolates here? If not, I worry you'll get
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.
Hmm. I thought it did, because the script worked despite the content push step having nested quotes, but upon closer inspection it looks like what you have above is exactly what we'd get.
In other words, I'm not actually sure what's going on here. I'll investigate more.
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.
Ahh, I forgot that we're going up through two levels of server, so we actually need that many levels of escaping; as it turns out, we weren't actually wrapping
user_name
in quotes in our original call tocontent-push
; giving it a name with whitespace would cause it to blow up.No longer!