Consider:
build@build:~$ for f in *.tbz2 *.ps *.pdf; do
> curl -F operations='{
> "query": "mutation($id: Int!, $rev: String!, $file: Upload!) {uploadArtifact(repoId: $id, revspec: $rev, file: $file) { created, filename, checksum } }",
> "variables": { "file": null, "rev": "'"$rev"'", "id": '"$id"' }
> }' \
> -F map='{
> "a": ["variables.file"]
> }' \
> -F a=@"$f" \
> https://git.sr.ht/query
> echo
> done
+ for f in *.tbz2 *.ps *.pdf
+ curl --oauth2-bearer stripped -F 'operations={
"query": "mutation($id: Int!, $rev: String!, $file: Upload!) {uploadArtifact(repoId: $id, revspec: $rev, file: $file) { created, filename, checksum } }",
"variables": { "file": null, "rev": "2", "id": 210654 }
}' -F 'map={
"a": ["variables.file"]
}' -F a=@ratrun-2-man.tbz2 https://git.sr.ht/query
{"errors":[{"message":"Put \"https://patchouli.sr.ht/git.sr.ht/\": context deadline exceeded","path":["uploadArtifact"]}],"data":null}+ echo
+ for f in *.tbz2 *.ps *.pdf
+ curl --oauth2-bearer stripped -F 'operations={
"query": "mutation($id: Int!, $rev: String!, $file: Upload!) {uploadArtifact(repoId: $id, revspec: $rev, file: $file) { created, filename, checksum } }",
"variables": { "file": null, "rev": "2", "id": 210654 }
}' -F 'map={
"a": ["variables.file"]
}' -F a=@ratrun-2.ps https://git.sr.ht/query
{"data":{"uploadArtifact":{"created":"2022-11-03T16:42:29.336543Z","filename":"ratrun-2.ps","checksum":"sha256:5679f0773ecb6b468c890fabb9bafdc832521de9a12024b968208496e1daa586"}}}+ echo
+ for f in *.tbz2 *.ps *.pdf
+ curl --oauth2-bearer stripped -F 'operations={
"query": "mutation($id: Int!, $rev: String!, $file: Upload!) {uploadArtifact(repoId: $id, revspec: $rev, file: $file) { created, filename, checksum } }",
"variables": { "file": null, "rev": "2", "id": 210654 }
}' -F 'map={
"a": ["variables.file"]
}' -F a=@ratrun-2.pdf https://git.sr.ht/query
{"data":{"uploadArtifact":{"created":"2022-11-03T16:42:29.842201Z","filename":"ratrun-2.pdf","checksum":"sha256:ec185cac6982bbd065bc3ff58d92369453500f05c1ec7b09d338a2c49434b9a1"}}}+ echo
and
+ for f in *.tbz2 *.ps *.pdf
+ curl --oauth2-bearer stripped -F 'operations={
"query": "mutation($id: Int!, $rev: String!, $file: Upload!) {uploadArtifact(repoId: $id, revspec: $rev, file: $file) { created, filename, checksum } }",
"variables": { "file": null, "rev": "1", "id": 210654 }
}' -F 'map={
"a": ["variables.file"]
}' -F a=@ratrun-1-man.tbz2 https://git.sr.ht/query
{"data":{"uploadArtifact":{"created":"2022-11-03T16:38:51.637655Z","filename":"ratrun-1-man.tbz2","checksum":"sha256:eace89e8f756b0b3acdfc00b0d3dc2c983a4278a7dd70259ffec2c57f8db3e7d"}}}+ echo
+ for f in *.tbz2 *.ps *.pdf
+ curl --oauth2-bearer stripped -F 'operations={
"query": "mutation($id: Int!, $rev: String!, $file: Upload!) {uploadArtifact(repoId: $id, revspec: $rev, file: $file) { created, filename, checksum } }",
"variables": { "file": null, "rev": "1", "id": 210654 }
}' -F 'map={
"a": ["variables.file"]
}' -F a=@ratrun-1.ps https://git.sr.ht/query
{"data":{"uploadArtifact":{"created":"2022-11-03T16:38:52.118896Z","filename":"ratrun-1.ps","checksum":"sha256:5679f0773ecb6b468c890fabb9bafdc832521de9a12024b968208496e1daa586"}}}+ echo
+ for f in *.tbz2 *.ps *.pdf
+ curl --oauth2-bearer stripped -F 'operations={
"query": "mutation($id: Int!, $rev: String!, $file: Upload!) {uploadArtifact(repoId: $id, revspec: $rev, file: $file) { created, filename, checksum } }",
"variables": { "file": null, "rev": "1", "id": 210654 }
}' -F 'map={
"a": ["variables.file"]
}' -F a=@ratrun-1.pdf https://git.sr.ht/query
{"data":{"uploadArtifact":{"created":"2022-11-03T16:38:52.517419Z","filename":"ratrun-1.pdf","checksum":"sha256:ec185cac6982bbd065bc3ff58d92369453500f05c1ec7b09d338a2c49434b9a1"}}}+ echo
So why are they not showing up in https://git.sr.ht/~nabijaczleweli/ratrun/refs/1 or https://git.sr.ht/~nabijaczleweli/ratrun/refs/2?
(There are some there, for v2
and 2b
tags – which work fine – which I've created later as a test; do observe there are no ratrun-[12]-*
files!)
Just guessing the URL doesn't work (404), so I guess it really isn't uploaded? Despite returning success?
Uploading from the web UI does work.
As a work-around, you can abuse the sourcehutism of uploading-to-commit by setting
revspec
to the SHA instead of the tag name.