Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to configure pipeline jobs using the JCasC plugin #2364

Open
mkjkec2005 opened this issue Sep 9, 2023 · 0 comments
Open

Not able to configure pipeline jobs using the JCasC plugin #2364

mkjkec2005 opened this issue Sep 9, 2023 · 0 comments
Labels

Comments

@mkjkec2005
Copy link

mkjkec2005 commented Sep 9, 2023

Hello,

I am getting below error while trying to configure pipeline jobs using the plugin.

Failed ConfigurationAsCode.init
io.jenkins.plugins.casc.ConfiguratorException: Found incompatible configuration elements YamlSource: /var/jenkins_home/casc_configs/jobs.yaml

Below is the snippet i added to my Jenkins values.yaml file. Please note that the installation is using Helm.

JCasC:
defaultConfig: false
configScripts:
welcome-message: |
jenkins:
systemMessage: Welcome to our CI\CD server. This Jenkins is configured and managed 'as code'.
pipeline-job: |
jobs:
- script: >
folder('TEST')
- script: >
pipelineJob('TEST/Hello-world') {
description('Master job for CI pipeline')
parameters {
string(name: 'PULL_REQUEST_FROM_REPO_ID', defaultValue: '', description: 'Pull request parameters')
string(name: 'PULL_REQUEST_FROM_BRANCH', defaultValue: '', description: 'Pull request parameters')

            }
            properties {
                buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '80'))
                disableConcurrentBuilds()
            }
          definition {
          cpsScm {
           scm {
            git {
              remote {
                url("https://mybitbucket.com/scm/sandbox/repo.git")
                credentials('my-cred')  
              }
              branches('*/master')  // Configure the branch you want to build
              scriptPath('Jenkinsfile')  // Path to your Jenkinsfile in the repository
              }
            }
           }
          }
          }
  jenkins-credentials: |
    credentials:
      system:
        domainCredentials:
        - credentials:
           - usernamePassword:

Could you please help to understand what is missing in above snippet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant