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

Branch name is missing when collecting git info from GitLab #2827

Open
guybar opened this issue Jan 12, 2025 · 3 comments
Open

Branch name is missing when collecting git info from GitLab #2827

guybar opened this issue Jan 12, 2025 · 3 comments
Labels
feature request New feature or request

Comments

@guybar
Copy link

guybar commented Jan 12, 2025

When collecting git info from GitLab using the CLI command jf bag the GitLab branch name is not collected.

Expected:
Collect the branch name from the GitLab CI_COMMIT_BRANCH environment variable, and save it as the branch name in the build info

@guybar guybar added the feature request New feature or request label Jan 12, 2025
@RobiNino
Copy link
Contributor

RobiNino commented Feb 5, 2025

Hi @guybar ,
The jf rt bce command is used to collect environment variables to a build info.

The command you are looking for is jf rt bag which collects the Git revision and URL from the local .git directory and adds it to the build-info.
See the docs for more info.

@guybar
Copy link
Author

guybar commented Feb 6, 2025

you are correct, I was referring to the jf rt bag command, and you are correct it does not pick up the branch name, as you included in the example you had shared:
"vcs": [ { "revision": "e2c0e017902db2715cf0d6e488e74d841860d969", "message": "Initial commit", "branch": "", "url": "[email protected]:username/test.git" } ]

@agrasth
Copy link
Collaborator

agrasth commented Feb 6, 2025

@guybar Arey you performing this on GitLab CI pipeline ?

If you are working on a GitLab CI pipeline and trying to collect environment variables from there, you will see them in the properties. However, this will not include Git details in the vcs section.
For example:

{
    "properties": {
        "buildInfo.env.CI_COMMIT_BRANCH": "dev",

 }

Also if you are using build-add-git(jf rt bag) and haven't checkout to any branch on gitLab CI, it uses detached HEAD for the latest commit, which gives you vcs of

"vcs": [
        {
            "revision": "e2c0e017902db2715cf0d6e488e74d841860d969",
            "message": "Initial commit",
            "branch": "",
            "url": "[email protected]:username/test.git"
        }
    ]

This is what are you requesting for ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants