Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

Get Git Source not getting from correct branch



  • Hello,

    I've had an issue with Git source providers not working again and after upgrading to version 5.6.3, noticed that the following "Source Control Providers have been deprecated in favor of using tool-specific operations, such as Svn-Checkout and Git-GetSource."

    So I'm now trying to use the "Get Git Source" command, but can only get source from the master branch. I've searched for the command on the website, but can't find any documentation for it, just details for the "Get Latest" command.

    I'm assuming I have the syntax of the command partially correct, as it does retrieve files from Git. Here's the command (I've changed the urls and project name):

        Git-GetSource
        (
            RepositoryUrl: http://mygitlab.local/project/project2.git,
            DiskPath: C:\BuildMaster\deploy\projectLive,
            Branch: PRODUCTION,
            UserName: buildmaster,
            Password: mypassword,
            CleanWorkspace: true
        );
    

    As you can see, the branch is defined, but the code is picked up from master.
    The log states the branch production as well.

    I've deleted the repo details from C:\BuildMaster_WEBTMP\SrcRepos, but still get the same problem.

    Any ideas?

    Thanks,

    David

    Product: BuildMaster
    Version: 5.6.3



  • Thank you for the report - we added some more logging in the latest Git (and GitHub) extensions, and likely fixed this (problem was local branches were not being created). Let me know if v5.6.1 of the Git extension resolves this.



  • Hello,

    There was an update available (I did think they were all up to date), it's now at 5.6.1. However, I think that is worse, it's not picking up the production branch or the master branch. I only knew it was picking up the master branch before, as I'd put a file called master in it, same as production.
    We have a few other branches, so I'm assuming it's one of those.

    This is the log from the job as it is running. Is there are more detailed log anywhere?

    Getting source from 'http://gitlan/*****/*****2.git' on 'PRODUCTION' branch...
    Using LocalAgent agent on BUILDMASTER3
    No executable path specified, using build-in git library...
    Using repository at 'C:\BuildMaster\_SVCTMP\GitWorkspaces\******2.git'...
    Finding local branch 'PRODUCTION'...
    Using local branch 'refs/heads/PRODUCTION'...
    Fetching commits from origin...
    Connecting as user 'buildmaster'...
    Using repository at 'C:\BuildMaster\_SVCTMP\GitWorkspaces\******2.git'...
    Archiving HEAD ('refs/heads/PRODUCTION', commit '7df0b2dcd6012138797d4fe5c0a4e8b8014b6419') to 'C:\BuildMaster\deploy\******'....
    


  • I would suggest manually deleting that workspace at C:\BuildMaster\_SVCTMP\GitWorkspaces\******2.git and trying again. There should not have been a local branch in that workspace if the extension was just upgraded (unless it were created in a previous execution after the extension was upgraded of course).

    After that, can you verify the files at the listed SHA commit match?



  • Hi,

    Thanks for your help, that's all working now.

    Regards,

    David



  • Hi,

    I've noticed that any new files we push to Git aren't be pulled. It seems to be because C:\BuildMaster_SVCTMP\GitWorkspaces\ subfolders aren't being cleared out.

    So I put a line to delete the contents in the script and it worked.

    Is that what this line should do: CleanWorkspace: true

    Thanks,

    David



  • You are correct, CleanWorkspace is supposed to delete that directory but apparently it is ignoring that value - we'll have a fix shortly in the next version.

    Regardless, new files should definitely come down without that setting. Note that by setting the DiskPath property as the final destination for the files, existing files in that directory will not be deleted. To ensure your target directory matches exactly what is in the repo, try something like:

    Git-GetSource
    (
        Credentials: GithubGitTest,
        Branch: master
    );
    
    Transfer-Files
    (
        Include: **,
        ToDirectory: c:\tmp\your-target-dir,
        DeleteTarget: true
    );
    

    Also worth noting is the Credentials property, if you go to Admin > Resource Credentials, you can create a Git Credential and put the username and password (and optionally repository URL) there so it's not directly in the script.



  • Hello,

    Thanks for the Credentials tip, that works fine.
    New files do not come down unless the workspace directory is clear. I've made a little video to show you what I mean: My Video

    Also, the workspaces directory seems to be based on the Git repo name, so if I ran 2 plans at the same time for different branches, from the same Git repo, Buildmaster would put all the files in the same directory. Is that correct?

    Thanks,

    David



  • Thank you for the video, was able to reproduce it after that and resolve it in the latest version.

    You are correct that the workspace would be the same. If they aren't run at the same time it's OK that they use the same workspace. For any Git operation you can specify your own WorkspaceDiskPath if you know there could be conflicts.



  • Hi Tod,

    Thanks very much for the reply, I'll check it out in the new version :-)

    Happy New Year!

    David



  • Hi David,

    I came across your post and noticed that you're experiencing an issue with Git source providers in BuildMaster. I understand that you're trying to use the "Get Git Source" command but can only get the source from the master branch.

    Based on the command you provided, it looks like you have the syntax partially correct. However, it seems that the code is being picked up from the master branch instead of the production branch that you specified.

    Have you tried specifying the branch name with the "refs/heads/" prefix? For example:

    bash
    Copy code
    Branch: refs/heads/PRODUCTION
    This may help in correctly identifying the production branch.

    Additionally, you mentioned that you have deleted the repo details from C:\BuildMaster_WEBTMP\SrcRepos, but are still facing the same issue. Have you tried clearing your Git credentials and re-entering them? It's possible that the issue may be related to authentication.

    Plus I was researching on Elmedia Player for Mac, and As someone who's been using Elmedia Player for Mac for quite some time, I can definitely say that it's a great media player that offers a lot of useful features. One thing I particularly appreciate about Elmedia Player is its ability to play virtually any video or audio format that you throw at it.


Log in to reply
 

Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation