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

Parity with standard Jenkinsfile for Docker #42

Open
m0un10 opened this issue Jan 8, 2021 · 3 comments
Open

Parity with standard Jenkinsfile for Docker #42

m0un10 opened this issue Jan 8, 2021 · 3 comments

Comments

@m0un10
Copy link

m0un10 commented Jan 8, 2021

Is your feature request related to a problem? Please describe.

Since the standard Jenkinsfile doesn't require an explicit clone, pipeline as yaml shouldn't either.

Describe the solution you'd like

When it is yaml from SCM it should automatically have the code cloned (as per the configuration) to be consistent with what happens for Jenkinsfile from SCM.

Describe alternatives you've considered

The workaround is to add an explicit checkout

This works..

pipeline {
    agent { 
        docker { 
            image 'maven:3.3.3' 
            reuseNode true
        }
    }
    stages {
        stage('build') {
            steps {
                sh 'mvn clean package'
            }
        }
    }
}

But this doesn't

pipeline:
  agent:
    docker:
      image: maven:3.3.3
      # 2. Reusing the node (double-check that this doesn't happen automatically)
      reuseNode: 'true'
  stages:
    - stage: "build"
      steps:
        - sh "mvn clean package"

Unless you add a clone step before the maven build

        - "checkout([$class: 'GitSCM', branches: [[name: '*/jenkins-poc']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'example-cred', url: 'https://github.com/example-org/example-repo.git']]])"
@m0un10
Copy link
Author

m0un10 commented Jan 8, 2021

Maybe this should be a bug instead of feature request but reporting as feature request in case the behaviour is as intended.

@aytuncbeken
Copy link
Contributor

Hi @m0un10 ,

On which job type you are experiencing this problem ? Pipeline or MultiBranch Pipeline ?

@m0un10
Copy link
Author

m0un10 commented Jan 26, 2021

The issue is with pipeline project when selecting "Pipeline As Yaml from SCM", it won't automatically do the checkout. I've just tested on multi-branch and it seems to be fine.

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

No branches or pull requests

2 participants