The private key in configuration-as-code placed under referenceContent of EC2 cloud is successfully imported, however jobs fail to connect to EC2 slaves. Once the (SAME) private key is configured MANUALLY through the UI, it works fine.

      Steps to reproduce:

      1. Install Jenkins using Helm chart (codecentric) and configure private key in values.yaml for this chart.
      2. Run helm install
      3. Run a job that uses EC2 slave
      4. Job fails
      5. Manually import private key in Jenkins system config
      6. Run job again... success

       

      No

          [JENKINS-60802] JCasC EC2 Plugin private key not working

          Richard Pula added a comment -

          I faced the same problem and it was because the remoteFS attribute was missing in my jenkins.yaml.

          Here an example:

            - amazonEC2:      
                cloudName: "Slaves EC2"      
                privateKey: "${KEY}"      
                region: "eu-central-1"      
                templates:      
                  - ami: "ami-0269d640534cbf7ea"        
                    amiType:          
                      unixData:            
                        sshPort: "22"
                    remoteFS: ""

           

          Richard Pula added a comment - I faced the same problem and it was because the  remoteFS  attribute was missing in my jenkins.yaml. Here an example: - amazonEC2: cloudName: "Slaves EC2" privateKey: "${KEY}" region: "eu-central-1" templates: - ami: "ami-0269d640534cbf7ea" amiType: unixData: sshPort: "22" remoteFS: ""  

            ewel Ewelina Wilkosz
            abarnas Ard-Jan Barnas
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: