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

Cannot set up custom SSH keys in Bamboo Java Specs

    XMLWordPrintable

Details

    Description

      Issue

      Bamboo Java Specs documentation describes (https://docs.atlassian.com/bamboo-specs-docs/6.3.1/specs-java.html#bitbucket-server-git-repository) users are able to set up Bitbucket Server repositories providing their own SSH keys

      Authentication with custom SSH keys
      Plan plan = new Plan(project, planName, planKey)
          .planRepositories(new BitbucketServerRepository()
              .name("my-bitbucket-repository")
              .server(bitbucketServerApplink)
              .projectKey("BBSPROJECT")
              .repositorySlug("my-repository-slug")
              .branch("master")
              .sshPrivateKey(sshPrivateKey)
              .sshPublicKey(sshPublicKey));
      

      However, Bamboo is not taking SSH keys provided into consideration whilst creation plan repository.

      How to replicate

      1. create SSH key pair following https://confluence.atlassian.com/bitbucketserver/creating-ssh-keys-776639788.html
      2. set up Bamboo Java Specs making use of SSH Key pair created on previous step
        .planRepositories(new BitbucketServerRepository()
            .name("my-bitbucket-repository")
            .server(new ApplicationLink()
                    .name("[Bitbucket 5.3.2]"))
            .projectKey("PROJ")
            .repositorySlug("dummy")
            .branch("master")
            .sshPrivateKey("-----BEGIN RSA PRIVATE KEY-----\n" +
                    "MIIEpAIBAAKCAQEA0/p+3TMKt0poTYzHVQvt89RRty/58js16BRetzobA68NBNNL\n" +
                    "uMpav7gAf7+I+Sf/DFrl3nY8x2tHO1+wJ9inn8aPFd14QyYcZFJJDFtpN01cFzbm\n" +
                    "LdVDZwLkOrOfEKxzBzUa2acTETFJepiVmiiqwC3VfBgsPeUlORhi2mqVLGJn5Gjq\n" +
                    "Q6Tqs0E8C74zBufc3CVXuretetOB2WvJMFh8VOw1fXV2/HGHljLnU8V/+MjIdvJN\n" +
                    "8dSEaTLLY70EtDcxpVnkQ9EYZsetF8wEwv4KHTMZ9LrqUaq+A2YQJlmO5RhZR+vP\n" +
                    "t9NHM4MhzpYSu3JYoAdYhLmQcj0LId9ZqT2BiQIDAQABAoIBAC6di4CBVP3xsvY6\n" +
                    "2yrssKtKKZ4rQr/uHXCn6hxI/t/UgvxoquI8PbCjehidujVwgjnpU1uUjNEd2lBI\n" +
                    "PqjEkDgmphic13GM0/mLztyUzZKHxJSmUgAKQgRJMn9mOLil87XGC92JTDwfppT7\n" +
                    "MQrxnnscmTHs7u29km332uVFQwC7TKycCMelpG/RFE605qc93G/aeAKOK+b2PMxO\n" +
                    "qAuRVjsO2M3T+MXeP8T3Zmevzd15z79mc55XIFoxn8eAx3Vb86E9j0Th6hwJLM84\n" +
                    "EvQTxZQslgXqNdFdjsAMj96BJoXZeWxUYwqV0hU985zrSwCZszGb17U4P9gTqpth\n" +
                    "opsxWgECgYEA8jn/LZLvtFqGaD9nVRtNGXD/Qh3A/jzAQMTwIcXzA8lepk4eYM3D\n" +
                    "mZTjfULwWbWyfsox4Uje0xRbRmSpLalu8QQcPiNcI3ao1ixHj1Ud4XWAl37vPuq3\n" +
                    "vPclnujpPTZpufI6iFQiCn90aQKpgqbyRAoi5udjvhxO+GKGAFgNSfkCgYEA4Agw\n" +
                    "X54w+7Pu+iuHBBKaV76VSHfV9P7NDygIMDjZQOeLyRSKMqQ3dQSFtYoCBtWaETzy\n" +
                    "rPKpsL1S+QEOmcHkuglPi4KO+sz2ZV8+ygyg0nhWmbiCWUYQNFGcUFwLQ9hRjq0y\n" +
                    "P84c3m8i9NsBqqfHRy/O0hWOSfs0lIFRACHeWBECgYEA011eWQNFnYf8jsz8uxv2\n" +
                    "nAOpCaVy+aZDUIFI1P+pPZ2itNWn1mrWipaMJ4qYtn9BQTfobKAsp920g+lkYs7d\n" +
                    "WvxuNJ6gUOXDEBhVXTI1v73LtuZxl+Iy8HZs4ox0shBgE3zWLI3VonlzOAq1padN\n" +
                    "8acyq3Av7f0/v6ghK/2poukCgYB4C0tIYS6kIOVj/eDqCMHVVJUPcM8f6Uyd23iP\n" +
                    "xlZ7ldbsV2o5+o6Q0GyJOzscyGY26G6sx5av0rLcJHnbX+8c1JJgEgRlVWCOLzwo\n" +
                    "7h1aygq1cg2+onFaZ4SX9so+f3IsPpgXYm1Lr0eO5q9870wz0+VB4zUMZWPmU2jA\n" +
                    "5mUK0QKBgQDrLf3bhGd+p6tdFAxZxFHLhXjKWms4r9M2GOpM/fOCyViZtxU8HIks\n" +
                    "P5x1x9mEsOA3NJc9bD22suVewSwgfeARgOyUfipGDZ+nkRDp9RFC4DlYxa5lGfgM\n" +
                    "+H5r4PKnsJSnqBLvDhhuz64y71+39hgwF9s/L5VP1bKZX2+7Le27Lg==\n" +
                    "-----END RSA PRIVATE KEY-----\n")
            .sshPublicKey("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDT+n7dMwq3SmhNjMdVC+3z1FG3L/nyOzXoFF63OhsDrw0E00u4ylq/uAB/v4j5J/8MWuXedjzHa0c7X7An2Kefxo8V3XhDJhxkUkkMW2k3TVwXNuYt1UNnAuQ6s58QrHMHNRrZpxMRMUl6mJWaKKrALdV8GCw95SU5GGLaapUsYmfkaOpDpOqzQTwLvjMG59zcJVe6t61604HZa8kwWHxU7DV9dXb8cYeWMudTxX/4yMh28k3x1IRpMstjvQS0NzGlWeRD0Rhmx60XzATC/godMxn0uupRqr4DZhAmWY7lGFlH68+300czgyHOlhK7cligB1iEuZByPQsh31mpPYGJ your_email@example.com"));
        

      Expected Result

      In Bamboo logs, we should find key being published to Bitbucket Server.

      Actual Result

      Instead, we find Bamboo generating and publishing its own SSH Key

      2018-07-30 09:58:45,988 INFO [http-nio-8085-exec-18] [BitbucketServerExporter] Public key was added to Bitbucket Server (Bamboo user: admin, application: [Bitbucket 5.3.2] [http://localhost:7990], location: repository PROJ/dummy): ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8Iy2RCgvObIDrWgre6OFq20T1xi4mceID9VED5mfjm2ICuzQx92Q3bLsRzKBHjqHsVhzjXOoKNiYxPwPK7fdFaw951oG6dzWujKpN1cXyFy8emQ4qW0e8uAzWjBPWgbYxHJo7chYQymZ4U8sIvIgSrCGvRIXKSY7Zv8OFqc+wYk5L8tI08DlhCfNJIGCVAthD7C6H1GswjYWyewGJ8VWVwPyIOyTtnDn8ZILxpdSux6gxz+BSjIZjav1LmYuqhJzr4t9tn1zY2MOdVGg/jIE98gc/sspdfNIIOsj6sQzfNN2MMNLA6hELVnTv8O/A8t6ob+nyvLIPKXAUFNnvv8Fj http://localhost:8085
      

      Attachments

        Activity

          People

            mgardias Marcin Gardias
            rsperafico Rafael Sperafico (Inactive)
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: