Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-20592

Creating a linked repository via Bamboo Specs with incorrect project key casing causes remote events from Bitbucket to be ignored for that repository

      Issue Summary

      Creating a linked repository via Bamboo Specs with incorrect project key or repository slug casing causes remote events from Bitbucket to be ignored for that repository.

      projectKey value must be uppercase to be valid
      repositorySlug value must be lowercase to be valid

      Steps to Reproduce

      1. Push a Bitbucket Server linked repository via Specs to Bamboo with a lowercase project key and uppercase repository slug. E.g.
        import com.atlassian.bamboo.specs.api.BambooSpec;
        import com.atlassian.bamboo.specs.api.builders.BambooKey;
        import com.atlassian.bamboo.specs.api.builders.BambooOid;
        import com.atlassian.bamboo.specs.api.builders.applink.ApplicationLink;
        import com.atlassian.bamboo.specs.api.builders.permission.PermissionType;
        import com.atlassian.bamboo.specs.api.builders.permission.Permissions;
        import com.atlassian.bamboo.specs.api.builders.permission.PlanPermissions;
        import com.atlassian.bamboo.specs.api.builders.plan.Job;
        import com.atlassian.bamboo.specs.api.builders.plan.Plan;
        import com.atlassian.bamboo.specs.api.builders.plan.PlanIdentifier;
        import com.atlassian.bamboo.specs.api.builders.plan.Stage;
        import com.atlassian.bamboo.specs.api.builders.plan.branches.BranchCleanup;
        import com.atlassian.bamboo.specs.api.builders.plan.branches.PlanBranchManagement;
        import com.atlassian.bamboo.specs.api.builders.plan.configuration.ConcurrentBuilds;
        import com.atlassian.bamboo.specs.api.builders.project.Project;
        import com.atlassian.bamboo.specs.api.builders.repository.VcsChangeDetection;
        import com.atlassian.bamboo.specs.builders.repository.bitbucket.server.BitbucketServerRepository;
        import com.atlassian.bamboo.specs.builders.repository.viewer.BitbucketServerRepositoryViewer;
        import com.atlassian.bamboo.specs.util.BambooServer;
        
        @BambooSpec
        public class MyLinkedRepository {
            
            public BitbucketServerRepository repository() {
                final BitbucketServerRepository repository = new BitbucketServerRepository()
                            .name("LINKEDREPO")
                            .repositoryViewer(new BitbucketServerRepositoryViewer())
                            .server(new ApplicationLink()
                                    .name("Bitbucket")
                                    .id("$APPLINK_ID"))
                            .projectKey("low")
                            .repositorySlug("UPPERCASE-SLUG")
                            .sshPublicKey("$SSH_PUBLIC_KEY")
                            .sshPrivateKey("$ENCRYPTED_PRIVATE_KEY")
                            .sshCloneUrl("ssh://git@bitbucket:7999/low/uppercase-slug.git")
                            .changeDetection(new VcsChangeDetection());
                return repository;
            }
            
            public static void main(String... argv) {
                //By default credentials are read from the '.credentials' file.
                BambooServer bambooServer = new BambooServer("http://bamboo:8085/");
                final MyLinkedRepository myLinkedRepository = new MyLinkedRepository();
                
                final BitbucketServerRepository repository = myLinkedRepository.repository();
                bambooServer.publish(repository);
            }
        }
        
      2. Create a plan using that linked repository
      3. Push a commit to Bitbucket for that repository

      Expected Results

      Plan triggers

      Actual Results

      Plan doesn't trigger as projectKey and repository slug on inbound remote event doesn't match what's stored against the repository.

      Notes

      1. Manual run works fine
      2. Viewing the Repository setting through Bamboo Administration does not show any error
      3. The problem will happen to plan repository as well

      Workaround

      Re-save the repository via the UI to persist correct casing or
      Fix the casing in the Bamboo Spec and repush:

      • .projectKey value must be uppercase
      • .repositorySlug value must be lowercase

            [BAM-20592] Creating a linked repository via Bamboo Specs with incorrect project key casing causes remote events from Bitbucket to be ignored for that repository

            There are no comments yet on this issue.

              achystoprudov Alexey Chystoprudov
              jowen@atlassian.com Jeremy Owen
              Affected customers:
              15 This affects my team
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: