Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    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

    Scheduled Pinned Locked Moved Support
    buildmastergit
    11 Posts 2 Posters 36 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ? This user is from outside of this forum
      Guest
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • ? This user is from outside of this forum
        Guest
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • ? This user is from outside of this forum
          Guest
          last edited by

          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\******'....
          
          1 Reply Last reply Reply Quote 0
          • ? This user is from outside of this forum
            Guest
            last edited by

            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?

            1 Reply Last reply Reply Quote 0
            • ? This user is from outside of this forum
              Guest
              last edited by

              Hi,

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

              Regards,

              David

              1 Reply Last reply Reply Quote 0
              • ? This user is from outside of this forum
                Guest
                last edited by

                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

                1 Reply Last reply Reply Quote 0
                • ? This user is from outside of this forum
                  Guest
                  last edited by

                  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.

                  1 Reply Last reply Reply Quote 0
                  • ? This user is from outside of this forum
                    Guest
                    last edited by

                    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

                    1 Reply Last reply Reply Quote 0
                    • ? This user is from outside of this forum
                      Guest
                      last edited by

                      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.

                      1 Reply Last reply Reply Quote 0
                      • ? This user is from outside of this forum
                        Guest
                        last edited by

                        Hi Tod,

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

                        Happy New Year!

                        David

                        1 Reply Last reply Reply Quote 0
                        • S Offline
                          spaceu201_3158
                          last edited by

                          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.

                          1 Reply Last reply Reply Quote 0

                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                          With your input, this post could be even better 💗

                          Register Login
                          • 1 / 1
                          • First post
                            Last post
                          Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation