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

Git-Maven demo: Switch to the jenkinsfile-runner:maven image pack #388

Merged
merged 2 commits into from
Oct 9, 2020

Conversation

rsvoboda
Copy link
Collaborator

@rsvoboda rsvoboda commented Oct 9, 2020

Update git-maven to use jenkinsfile-runner:maven

Fixes #385
Hope it matches the expectation.

Few concerns:

  • image size is not small
  • pulling a lot of layers

Question:
What happens under the hood when I add:

    post {
        always {
            junit '**/TEST*.xml'
        }
    }

?

In console log I see Recording test results when using docker way, with java -jar way I see error because of missing plugin.
But what really happens with archived results, can I get them somewhere or they got deleted because everything runs in temporary directory?

@rsvoboda rsvoboda requested a review from a team as a code owner October 9, 2020 06:19
@oleg-nenashev
Copy link
Member

image size is not small

@rsvoboda you are right, the image size is far from optimal. It is a "known issue" with a few references in the bugtracker (e.g. #226), but not all problems were referenced there. I have added analysis to jenkinsci/jenkinsfile-runner-image-packs#5

I also have some experiments for building native JFR images with Graal/Quarkus, but they will not be applicable to JDK-focused images event when finalized.

pulling a lot of layers

Yes, quite a lot. Some of them come from AdoptOpenJDK. Others come from https://github.com/jenkinsci/jenkinsfile-runner-image-packs/blob/main/maven/Dockerfile-jdk8 which is optimized for readability, not for the layers number. Layers number can be optimized in the future. Once the base images stabilize, I plan to start striping them properly.

@oleg-nenashev
Copy link
Member

oleg-nenashev commented Oct 9, 2020

What happens under the hood when I add:

This is a part of the Declarative Pipeline. It gets converted to a scripted Pipeline form for execution in the Pipeline's DSL execution engine, basically to...

try {
  // build stage
  ...
} finally {
  junit '**/TEST*.xml'
}

I see error because of missing plugin

Right, it will not work as is. Vanilla package in this repository and have different plugins define. So java -jar ../../app/target/jenkinsfile-runner-standalone.jar -p ../../vanilla-package/target/plugins/ ... will not have plugins needed for this build. Better to just delete the local option or move it to the Image Pack repository

But what really happens with archived results, can I get them somewhere or they got deleted because everything runs in temporary directory?

Yes, everything gets deleted after the execution. There are summaries printed to the build log though. Ways to export the data:

  • Copy the test reports to the workspace or return it via a volume
  • Use other Jenkins plugins and Pipeline steps to report the data to external service (e.g. TestLink or TestRail).
  • Use the external test results storage, currently in preview with a reference implementation for PostgreSQL by @timja (see this page)

There is #67 for doing something more fancy (e.g. exporting reports as HTML), but I cannot provide ETA for it.

@rsvoboda
Copy link
Collaborator Author

rsvoboda commented Oct 9, 2020

Thanks for details. I got curious thanks to Common reporting plugins for unit tests, code coverage, performance reports, etc. bullet in https://github.com/jenkinsci/jenkinsfile-runner-image-packs/tree/main/maven

So I tried how this works, my naive part expected some reports copy to appear in current directory, my realistic me didn't expect anything to appear :)

Can I get the list of plugins available in jenkinsfile-runner-image-packs docker file? It could be handy to have it listed in REDME or dedicated file (for example under https://github.com/jenkinsci/jenkinsfile-runner-image-packs/tree/main/maven).

If the traditional Jenkins reporting plugins are for no real use in jenkinsfile-runner, they could be removed => size trimmed.
Using external services for tracking results makes more sense in cloud-ish era.

@oleg-nenashev
Copy link
Member

oleg-nenashev commented Oct 9, 2020

Thanks for details. I got curious thanks to Common reporting plugins for unit tests, code coverage, performance reports, etc. bullet in https://github.com/jenkinsci/jenkinsfile-runner-image-packs/tree/main/maven

Yes, the demo is largely work-in-progress, and the use-cases need to be implemented better. For my projects I'd rather use GitHub Checks API reporting once JUnit reports are supported there: https://www.jenkins.io/blog/2020/08/03/github-checks-api-plugin-coding-phase-2/ , but it is not a good option for demo purposes. GitHub App authentication needs to be configured there.

So I tried how this works, my naive part expected some reports copy to appear in current directory, my realistic me didn't expect anything to appear :)

I hope it gets closer to naive expectations over time :)

Can I get the list of plugins available in jenkinsfile-runner-image-packs docker file? It could be handy to have it listed in REDME or dedicated file (for example under https://github.com/jenkinsci/jenkinsfile-runner-image-packs/tree/main/maven).

There is even a TODO for it in the comments :) It is yet to be documented, but https://jenkinsci.github.io/maven-hpi-plugin/list-plugin-dependencies-mojo.html should work for all JFR images using JFR Packaging POM. It does not list transitive dependencies though...

Output for the current image:

[INFO] --< io.jenkins.jenkinsfile-runner:io.jenkins.jenkinsfile-runner.packs >--
[INFO] Building jenkinsfile-runner-maven 1.0-beta-17
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-hpi-plugin:3.15:list-plugin-dependencies (default-cli) @ io.jenkins.jenkinsfile-runner.packs ---
[INFO] io.jenkins.plugins:warnings-ng:8.2.0
[INFO] io.jenkins:configuration-as-code:1.41
[INFO] org.jenkins-ci.main:maven-plugin:3.6
[INFO] org.jenkins-ci.plugins.workflow:workflow-api:2.40
[INFO] org.jenkins-ci.plugins.workflow:workflow-basic-steps:2.20
[INFO] org.jenkins-ci.plugins.workflow:workflow-cps:2.80
[INFO] org.jenkins-ci.plugins.workflow:workflow-durable-task-step:2.35
[INFO] org.jenkins-ci.plugins.workflow:workflow-job:2.39
[INFO] org.jenkins-ci.plugins.workflow:workflow-multibranch:2.22
[INFO] org.jenkins-ci.plugins.workflow:workflow-scm-step:2.11
[INFO] org.jenkins-ci.plugins.workflow:workflow-support:3.5
[INFO] org.jenkins-ci.plugins:apache-httpcomponents-client-4-api:4.5.10-2.0
[INFO] org.jenkins-ci.plugins:cloudbees-folder:6.14
[INFO] org.jenkins-ci.plugins:cobertura:1.16
[INFO] org.jenkins-ci.plugins:credentials-binding:1.23
[INFO] org.jenkins-ci.plugins:email-ext:2.16
[INFO] org.jenkins-ci.plugins:git:4.2.2
[INFO] org.jenkins-ci.plugins:jdk-tool:1.4
[INFO] org.jenkins-ci.plugins:jsch:0.1.55.2
[INFO] org.jenkins-ci.plugins:junit:1.29
[INFO] org.jenkins-ci.plugins:mailer:1.32
[INFO] org.jenkins-ci.plugins:parallel-test-executor:1.13
[INFO] org.jenkins-ci.plugins:pipeline-stage-step:2.5
[INFO] org.jenkins-ci.plugins:pipeline-utility-steps:2.6.1
[INFO] org.jenkins-ci.plugins:scm-api:2.6.3
[INFO] org.jenkins-ci.plugins:script-security:1.73
[INFO] org.jenkins-ci.plugins:ssh-credentials:1.18.1
[INFO] org.jenkins-ci.plugins:timestamper:1.11.5
[INFO] org.jenkinsci.plugins:pipeline-model-definition:1.7.1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.272 s
[INFO] Finished at: 2020-10-09T11:02:05+02:00
[INFO] ------------------------------------------------------------------------

Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, will merge the PR once the CI passes. I plan to cut a new release tonight. This and the previous PRs should go inside

@oleg-nenashev oleg-nenashev merged commit 01c9fb9 into jenkinsci:master Oct 9, 2020
@oleg-nenashev oleg-nenashev added the documentation Documentation updates label Oct 9, 2020
@oleg-nenashev oleg-nenashev changed the title docs: Update git-maven to use jenkinsfile-runner:maven Update the Git-Maven demo to use the jenkinsfile-runner:maven image pack Oct 9, 2020
@oleg-nenashev oleg-nenashev changed the title Update the Git-Maven demo to use the jenkinsfile-runner:maven image pack Git-Maven demo: Switch to the jenkinsfile-runner:maven image pack Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update maven+Git demo to use the Maven Image Pack
2 participants