-
Bug
-
Resolution: Fixed
-
Low
-
6.0.0
-
None
-
3
-
Severity 3 - Minor
-
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
- 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); } }
- Create a plan using that linked repository
- 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
- Manual run works fine
- Viewing the Repository setting through Bamboo Administration does not show any error
- 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