chapel icon indicating copy to clipboard operation
chapel copied to clipboard

[Bug]: 'mason publish' fails to add tags for remote package repo

Open benharsh opened this issue 1 year ago • 2 comments

When mason publish is executed, a tag is neither created nor pushed to a remote repository for the package.

We either need to:

a) treat this as a bug that needs fixing, or... b) document that this requires some manual user intervention

benharsh avatar May 08 '24 00:05 benharsh

I had a quick look at MasonPublish.chpl (but this was very quick and while livecoding on stream, so easy I missed something).

It seems it tries to create the tag in these lines

      if !exists(safeDir + "/Bricks/" + name + "/" + versionNum + ".toml") {
        const baseToml = tomlFile;
        var newToml = open(safeDir + "/Bricks/" + name + "/" + versionNum + ".toml", ioMode.cw);
        var tomlWriter = newToml.writer(locking=false);
        baseToml["brick"]!.set("source", projectLocal);
        tomlWriter.write(baseToml);
        tomlWriter.close();
        const gitMessageString = ('git tag -a "v' + versionNum + '" -m "' + name + '"');
        commitSubProcess(projectLocal, ['git','tag','-a',"v"+versionNum,'-m',name]);
        return name + '@' + versionNum;
      }

(note also that the constant gitMessageString is not used and the same command is recreated in the line below.

I checked my repository locally and no tag was created, so that command seem to fail. I haven't looked deeper, but stating the obviuos, possible reasons are.

  1. The branch is not entered, which would mean the given toml file already exists. This should really not be the case
  2. The commitSubProcess fails (maybe missing permissions). However, when I ran mason publish I did not get any error message indicating something didn't work, so if this is the case, it was a silent failure.

Looking at the file, I didn't find any git push --tags so as far as I can tell, the function does not try to push the tags, so that's a missing feature probably.

lucaferranti avatar May 10 '24 20:05 lucaferranti

I think you're looking in the right place. In particular, I think that branch pertains to working with a local repository and package, rather than trying to add something to the remote public mason repository. We will need to add a git push --tags for both cases, I believe.

benharsh avatar May 13 '24 16:05 benharsh