martinthomson / i-d-template

A template for IETF internet draft git repositories
Other
207 stars 182 forks source link

CI submission and manual submission fail #343

Closed larseggert closed 1 year ago

larseggert commented 1 year ago

See https://github.com/NTAP/rfc8312bis/runs/8091216231?check_suite_focus=true#step:8:38.

For some reason, getting my email from git tag seems to fail.

What's worse, doing make upload locally has the same issue:

...
set -ex; email=""; \
[ -z "$email" ] && email=$(xmllint --xpath '/rfc/front/author[1]/address/email/text()' versioned/draft-ietf-tcpm-rfc8312bis-09.xml 2>/dev/null); \
[ -z "$email" ] && ! echo "Unable to find email to use for submission." 1>&2; \
curl -sS -D "versioned/.draft-ietf-tcpm-rfc8312bis-09.upload" \
  -F "user=$email" -F "xml=@versioned/draft-ietf-tcpm-rfc8312bis-09.xml" "https://datatracker.ietf.org/api/submit" && echo && \
  (head -1 "versioned/.draft-ietf-tcpm-rfc8312bis-09.upload" | grep -q '^HTTP/\S\S* 200\b' || lib/trace.sh versioned/draft-ietf-tcpm-rfc8312bis-09.xml -s upload-result ! cat "versioned/.draft-ietf-tcpm-rfc8312bis-09.upload" 1>&2)
+ email=
+ '[' -z '' ']'
++ xmllint --xpath '/rfc/front/author[1]/address/email/text()' versioned/draft-ietf-tcpm-rfc8312bis-09.xml
+ email=xu@unl.edu
+ '[' -z xu@unl.edu ']'
+ curl -sS -D versioned/.draft-ietf-tcpm-rfc8312bis-09.upload -F user=xu@unl.edu -F xml=@versioned/draft-ietf-tcpm-rfc8312bis-09.xml https://datatracker.ietf.org/api/submit
No such user: xu@unl.edu+ echo
...

This is odd, because:

# git tag --list --format '%(taggeremail)'
<lars@eggert.org>
<lars@eggert.org>
<lars@eggert.org>
<lars@eggert.org>
<lars@eggert.org>
<lars@eggert.org>
<lars@eggert.org>
<lars@eggert.org>
<lars@eggert.org>
<lars@eggert.org>
<lars@eggert.org>
<lars@eggert.org>
<lars@eggert.org>
<lars@eggert.org>
martinthomson commented 1 year ago

Wow, that's a real head-scratcher. There are a couple of things I can try out for you.

The first I've done already, which is to use a subshell for the git command rather than asking make to do the work (this is a good idea anyway as it avoids make running this command when it shouldn't).

The second is that maybe I need to mark the directory as safe. I'll do that in the image. (Edit: that was done a long time ago.)

martinthomson commented 1 year ago

FWIW, I ran the commands that GitHub ran on my own machine. (The debug output really helped there.) It did not fail when I did that. Hoping that the change I made helps.

larseggert commented 1 year ago

That didn't fix it.

I tried some things, and I think the problem is that the upload target tries to run git tag on the XML, which is not part of the repo and so has no tags. A second issue seems to be that the use of basename doesn't actually do anything, but that I can work around by changing that line to:

    set -ex; base=$$(basename $<); email="$$(git tag --list --format '%(taggeremail)' $$base | \

This still fails, because $< is versioned/draft-ietf-tcpm-rfc8312bis-09.xml.

martinthomson commented 1 year ago

This is running the make version of $(basename x), which is defined as removing the extension:

https://github.com/martinthomson/i-d-template/blob/753b3cf96206539b1bc02608cf14283ed76d1431/upload.mk#L27-L28

Note the single \$ here. Doubling it, as you have, sends the command to the shell.

The shell version, /usr/bin/basename, is defined as removing the directory part, only removing an extension if specified in the form basename dir/foo.xml .xml = foo.

Of course, now I have to dig out my mac, because anything I say about make is likely to be proven false by the ancient version that XCode ships.

martinthomson commented 1 year ago

GNU Make 4.2.1 on macOS 11.6.5 (Big Sur) produces "dir/foo" from $(basename dir/foo.xml), which seems OK.

larseggert commented 1 year ago

Thanks for the explanation. But isn't the issue still that

git tag --list --format '%(taggeremail)' versioned/draft-ietf-tcpm-rfc8312bis-09

tries to run git on versioned/draft-ietf-tcpm-rfc8312bis-09, which is not part of the repo?

martinthomson commented 1 year ago

🤦 I'm an idiot. I'll fix that.

martinthomson commented 1 year ago

a02d511 fixes this.

larseggert commented 1 year ago

Works!