Page MenuHomePhabricator

Train: support standard NETRC in automatic-branch-cut job
Closed, ResolvedPublic

Description

Caused some issues with the automatic branch cut today in for T366965: 1.43.0-wmf.20 deployment blockers (see T366965#10095192):

@hashar wrote:
The branches were cut last night but not pushed to Gerrit due to a change made in the cut script: https://gitlab.wikimedia.org/repos/releng/jenkins-deploy/-/commit/663c84371a60e1232a501e627c266899d4f5298f . That renamed an environment variable which as a result was no more recognized by the branching script. That change got rolled back and the release Jenkins has been redeployed. I have left a comment on that commit:


If we instead use the standard NETRC environment variable name, the file should be picked up by Python's requests library

That is a nice assumption, but git does not use requests. It uses libcurl with optional support for a .netrc in the user file. The automatic branch script at https://gitlab.wikimedia.org/repos/releng/release/-/blob/main/make-release/automatic-branch-cut does:

def setup_netrc():
   netrc_file = os.getenv("netrc_file")
   if netrc_file:
      netrc_dir = os.path.dirname(netrc_file)
      os.environ["HOME"]= netrc_dir
      os.symlink(netrc_file, os.path.join(netrc_dir, ".netrc"))
   else:
      print("netrc_file environment variable not set.  Will not be able to push the branch cut commit")

So essentially we require netrc_file to be set and then symlink that to ~/.netrc which is then found by git / libcurl.


Filing this so we have somewhere to track/talk.

If we want to update the environment variable, we'll need to update both release/make-release and in our branch cut job.

Event Timeline

dduvall updated https://gitlab.wikimedia.org/repos/releng/jenkins-deploy/-/merge_requests/71

Use standard NETRC environment variable name for netrc credential file

dduvall opened https://gitlab.wikimedia.org/repos/releng/release/-/merge_requests/111

make-release: Use the same credentials for Gerrit API and Git operations

dduvall opened https://gitlab.wikimedia.org/repos/releng/release/-/merge_requests/112

automatic-branch-cut: Remove check for netrc_file environment variable

dduvall closed https://gitlab.wikimedia.org/repos/releng/release/-/merge_requests/110

automatic-branch-cut: Remove check for netrc_file environment variable

dduvall merged https://gitlab.wikimedia.org/repos/releng/release/-/merge_requests/111

make-release: Use the same credentials for Gerrit API and Git operations

dduvall merged https://gitlab.wikimedia.org/repos/releng/release/-/merge_requests/112

automatic-branch-cut: Remove check for netrc_file environment variable

dduvall merged https://gitlab.wikimedia.org/repos/releng/jenkins-deploy/-/merge_requests/71

Use conventional NETRC environment variable name for netrc credential file

thcipriani assigned this task to dduvall.

Seems like this one is complete. Reopen if I'm wrong about that.