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

Build: READTHEDOCS_GIT_IDENTIFIER shouldn't be the commit SHA on versions from tags #11662

Open
drewcassidy opened this issue Oct 9, 2024 · 6 comments
Labels
Accepted Accepted issue on our roadmap Bug A bug

Comments

@drewcassidy
Copy link

drewcassidy commented Oct 9, 2024

Details

I'm using READTHEDOCS_GIT_IDENTIFIER in my docs to indicate the git tag to check out for a GitHub action. Unfortunately its rendering as the raw SHA

Expected Result

READTHEDOCS_GIT_IDENTIFIER is the name of the tag that was checked out

this is what the docs say it should be

Actual Result

READTHEDOCS_GIT_IDENTIFIER is the raw commit SHA

Workaround

I guess I can do a git describe

@humitos
Copy link
Member

humitos commented Oct 9, 2024

What's the URL of your project? What's the URL of the build where you're noticing this?

@drewcassidy
Copy link
Author

What's the URL of your project? What's the URL of the build where you're noticing this?

Added. I pasted the URLs into the template wrong I guess

@humitos
Copy link
Member

humitos commented Oct 9, 2024

READTHEDOCS_GIT_IDENTIFIER is the raw commit SHA

Where I should check the content of this variable in your documentation? I'm not able to find the the SHA in the page you linked.

@humitos humitos added Needed: more information A reply from issue author is required Needed: replication Bug replication is required labels Oct 9, 2024
@drewcassidy
Copy link
Author

drewcassidy commented Oct 9, 2024

the example line of - uses: KSPModdingLibs/KSPBuildTools/.github/actions/assemble-release@f89bab355278f61eabb8d8848746a9ce74a256bd is auto-generated using that environment variable

It should say - uses: KSPModdingLibs/KSPBuildTools/.github/actions/assemble-release@0.0.2-alpha.7 since the tag name being built is 0.0.2-alpha.7

@humitos
Copy link
Member

humitos commented Oct 10, 2024

I'm not able to reproduce this issue. I did a try at https://test-builds.readthedocs.io/en/full-feature/environment-variables.html and you can see there that READTHEDOCS_GIT_COMMIT_HASH: 185f27fa0b5d052862be2fca53c19ddb22d325e6 and READTHEDOCS_GIT_IDENTIFIER: full-feature. Those variables are pointing to the correct values.

@humitos
Copy link
Member

humitos commented Oct 10, 2024

I think that variable is never the tag name. It seems that it can only be a branch name and or a commit sha when it's a tag. Using my previous branch, I created a tag named v0.1-full-feature and built it on Read the Docs.

Taking a look at the same page, https://test-builds.readthedocs.io/en/v0.1-full-feature/environment-variables.html, we can see that both environment variables have the same value and it's a commit sha.

We use Version.identifier for READTHEDOCS_GIT_IDENTIFIER and based on what this comment says, it will always be a SHA if it's a tag:

#: The identifier is the ID for the revision this is version is for.
#: This is the commit hash (e.g. in Git).
#: If the this version is pointing to a branch,
#: then ``identifier`` will contain the branch name.
#: `None`/`null` means it will use the VCS default branch.
identifier = models.CharField(
_("Identifier"), max_length=255, null=True, blank=True
)

I found that calling git describe as you mentioned you can get the tag's name from a commit:

▶ git describe --tags 185f27fa0b5d052862be2fca53c19ddb22d325e6
v0.1-full-feature

This is a bug and we should fix it.

@humitos humitos added Bug A bug Accepted Accepted issue on our roadmap and removed Needed: more information A reply from issue author is required Needed: replication Bug replication is required labels Oct 10, 2024
@humitos humitos changed the title READTHEDOCS_GIT_IDENTIFIER does not actually have the tag name Build: READTHEDOCS_GIT_IDENTIFIER shouldn't be the commit SHA on versions from tags Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Accepted issue on our roadmap Bug A bug
Projects
Status: Planned
Development

No branches or pull requests

2 participants