jenkins.io icon indicating copy to clipboard operation
jenkins.io copied to clipboard

Creating your first Pipeline page - Docker example does not work, there is a step missing

Open atsalolikhin-spokeo opened this issue 4 years ago • 1 comments

Problem with the Creating your first Pipeline page, source file

As a new user, I'm going through the Guided Tour.

I've added a multi-branch pipeline monitoring a Git repository.

My Jenkinsfile is the example Python one, which uses a Docker agent.

BTW, when I installed Docker, I just took the recommended plugins. (Nowhere in the Guided Tour did it say that I had to install a special plugin to make Docker work.)

My first build failed with:

Branch indexing
 > git rev-parse --is-inside-work-tree # timeout=10
Setting origin to file:///Users/atsalolikhin/git/learn-jenkins
 > git config remote.origin.url file:///Users/atsalolikhin/git/learn-jenkins # timeout=10
Fetching origin...
Fetching upstream changes from origin
 > git --version # timeout=10
 > git --version # 'git version 2.27.0'
 > git config --get remote.origin.url # timeout=10
 > git fetch --tags --force --progress -- origin +refs/heads/*:refs/remotes/origin/* # timeout=10
Seen branch in repository origin/master
Seen 1 remote branch
Obtained Jenkinsfile from cddc3394f5df71715091726724832f78e454442b
Running in Durability level: MAX_SURVIVABILITY
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 2: Invalid agent type "docker" specified. Must be one of [any, label, none] @ line 2, column 13.
       agent { docker { image 'python:3.5.1' } }
               ^

1 error

	at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1085)
	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
	at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
	at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:142)
	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:127)
	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:561)
	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:522)
	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:337)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:428)
Finished: FAILURE

I went to "Manage plugins" and there is a bewildering number of Docker plugins. I installed "Docker Pipeline" as that's the first one that seemed to fit and make sense.

After this, I am able to run Jenkins builds using Docker agents.

Screenshots

N/A

Possible Solution

Add the step of "install Docker Pipeline plugin" to the Guided Tour?

atsalolikhin-spokeo avatar Aug 24 '20 19:08 atsalolikhin-spokeo

Yes! Please add this to the documentation. I ran into the same problem. Installing the docker pipeline plugin fixed the problem.

4wdmh avatar Dec 16 '20 01:12 4wdmh

Hey @MarkEWaite @vsilverman Can I please contribute in this issue?

Samiatrix avatar Sep 30 '22 03:09 Samiatrix

Yes @Samiatrix you are welcome to contribute to this issue.

Steps that I think you should take:

  • [ ] Perform the existing steps that are described in the tutorial and note the areas where you have problems in those steps
  • [ ] Compare the problems you encountered with the problems described by @atsalolikhin-spokeo and @4wdmh
  • [ ] Create a pull request to resolve those problems

MarkEWaite avatar Sep 30 '22 15:09 MarkEWaite

Followed the steps and improved the instructions.

As described in the issue, added instructions for "docker plugin" installation as a step and updated the instructions to ease pipeline creating using the examples without any error.

Additionally, added a video link to the detailed pipeline page.

PR: https://github.com/jenkins-infra/jenkins.io/pull/5533

ankurkumarz avatar Oct 02 '22 05:10 ankurkumarz