Uploaded image for project: 'Bamboo'
  1. Bamboo
  2. BAM-13618

Ability to checkout and create tags in a Git repository

    XMLWordPrintable

    Details

    • Last commented by user?:
      true
    • Comments:
      26
    • Support reference count:
      31
    • UIS:
      29

      Description

      Problem Definition

      When creating release and deployment builds it commonly desired to tag the commit that was built. For example, the Maven release plugin does this automatically. For projects that don't use Maven we need a way to tag the release code to avoid manual steps.

      It is also useful to build from a Git tag. For example, when you need to redeploy a release artifact from the past that is not present in Bamboo.

      Suggested Solution

      • Add a build step that will tag the currently checked out commit.
      • Add the ability to select Git tags for build steps.
      • Make this work in Git repositories hosted in Stash and BitBucket as well.

      Workaround

      1. Configure Source Code Checkout task in the Build Plan to checkout source.git into a directory for building the code
      2. Add another Source Code Checkout task in the Build Plan at the bottom of the task to checkout deploy.git into another directory
      3. With this deploy.git, check what is the latest changeset/revision (probably “git log -1”) with a Script task to save the changeset/revision into a file
      4. Create an Artifact for this file in step 3
      5. In the environment task, use Script task to read this file in step 3 and perform Git checkout with it in the same Script task

      With this workaround, the deployment in other environment or rollback will be able to perform Git checkout on the same changeset/revision depending on the Artifact.

      NOTE: For this approach you will need to setup a private key on remote agent(s) so the agent will have permission to access the repository directly. This is because the credentials stored in the Bamboo server aren't available to the script task as it is executed by the 'bamboouser' on the remote agent.

        Attachments

          Issue Links

            Activity

              Dates

              • Created:
                Updated:
                Resolved:
                Last commented:
                10 weeks, 6 days ago