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

Fix a few bugs with the changelog creation script #13020

Merged
merged 4 commits into from Feb 3, 2017

Conversation

Hamms
Copy link
Contributor

@Hamms Hamms commented Feb 2, 2017

  • The changelog included merges between server branches
  • The changelog generation broke when the DTP included non-standard merges (like hotfixes)
  • The changelog editor failed on servers without an EDITOR environment variable, because nil.to_s returns a truthy empty string
  • The dotd script was attempting to run the create-release script from the home directory, but it needs to be run from within the github repo in order for git log to work

# ignore merges from staging; those represent DTTs
match['branch'] != 'staging'
# ignore merges from our various server branches
!match.nil? && !['staging', 'test', 'levelbuilder'].include?(match['branch'])
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an interesting question - do we ignore merges "from levelbuilder" because they're routine server-branch merges and so common as to be uninteresting, or do we include them because they represent legitimate content changes that may not happen in every published version?

Copy link
Contributor

Choose a reason for hiding this comment

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

We don't ignore them, IMO. It is often useful to know whether a scoop happened or not. In fact, it would be awesome to include timestamps (this would make it more helpful to non-eng, I'd guess).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I can see that. Particularly because we link to the contents of the scoop itself, it makes it easy to look for particular changes.

bin/dotd Outdated
@@ -167,7 +167,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\""
system "ssh -t gateway.code.org ssh -t \"production-daemon \\\"cd production; ./bin/create-release\\\"\""
Copy link
Contributor

Choose a reason for hiding this comment

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

faint

My eyes glaze over anytime I see nested escaped quotes. Can we mix quote types to make this a little less painful? Or even better, extract a helper run_on('production-daemon', 'cd production; ./bin/create-release') to hide the complexity?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oooh, I love the idea of a helper

Copy link
Contributor Author

Choose a reason for hiding this comment

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

run_on helper added; unfortunately had to do a little escaping to deal with bash/ssh's pickiness, Let me know what you think

bin/dotd Outdated
@@ -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 \\\"cd production; ./bin/create-release\\\"\""
run_on("production-daemon", "cd production; ./bin/create-release")
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

bin/dotd Outdated
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}\""
Copy link
Contributor

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

def run_on(server_name, command) # command='my "command"'
  command = %Q["#{command}"] # command='my \"command\"'
  system "ssh -t gateway.code.org ssh -t #{server_name} \"#{command}\""
  # 'ssh -t gateway.code.org ssh -t server \"my \"command\"\"'

Copy link
Contributor Author

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.

Copy link
Contributor Author

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 to content-push; giving it a name with whitespace would cause it to blow up.

No longer!

@Hamms
Copy link
Contributor Author

Hamms commented Feb 2, 2017

Circle failure is unrelated

@Hamms Hamms merged commit 23148a0 into staging Feb 3, 2017
@Hamms Hamms deleted the dotd-create-release-fixes branch February 3, 2017 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants