MLE-27841 Generating javadocs on each publish#1927
Conversation
This simplifies life for the docs team by allowing them to download the zip of docs.
|
Copyright Validation Results ⏭️ Skipped (Excluded) Files
✅ All files have valid copyright headers! |
There was a problem hiding this comment.
Pull request overview
Adds Javadoc generation and archiving to the CI publish workflow so the docs team can download a zipped Javadoc artifact from Jenkins.
Changes:
- Generate Javadocs after the
publishstage runs. - Zip the generated Javadocs and archive the zip as a Jenkins build artifact.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| zip -r javadoc.zip javadoc/ | ||
| mv javadoc.zip $WORKSPACE/ | ||
| ''' | ||
| archiveArtifacts artifacts: 'javadoc.zip', fingerprint: true |
There was a problem hiding this comment.
archiveArtifacts artifacts: 'javadoc.zip' will fail the build if the zip isn't produced (e.g., javadoc task fails or zip isn't available). To avoid an unintended publish failure, guard this with a fileExists('javadoc.zip') check and/or set allowEmptyArchive: true.
| archiveArtifacts artifacts: 'javadoc.zip', fingerprint: true | |
| script { | |
| if (fileExists('javadoc.zip')) { | |
| archiveArtifacts artifacts: 'javadoc.zip', fingerprint: true | |
| } | |
| } |
| ./gradlew javadoc | ||
| echo "Zipping javadocs for easy download..." | ||
| cd marklogic-client-api/build/docs | ||
| zip -r javadoc.zip javadoc/ |
There was a problem hiding this comment.
This step assumes the Jenkins agent has the zip CLI installed. If that's not guaranteed on javaClientLinuxPool, consider using a more universally available archiver (e.g., tar) or the JDK jar tool, or ensure zip is provisioned on the agent.
| zip -r javadoc.zip javadoc/ | |
| "$JAVA_HOME/bin/jar" cf javadoc.zip javadoc |
| post { | ||
| always { | ||
| sh label: 'generate-javadoc', script: '''#!/bin/bash | ||
| export JAVA_HOME=$JAVA_HOME_DIR | ||
| export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR | ||
| export PATH=$GRADLE_USER_HOME:$JAVA_HOME/bin:$PATH | ||
| cd java-client-api | ||
| ./gradlew javadoc | ||
| echo "Zipping javadocs for easy download..." |
There was a problem hiding this comment.
post { always { ... } } will run even when ./gradlew publish fails, and any failure in the javadoc/zip step will also fail the stage/build. If the intent is to publish docs only when publishing succeeds (and to avoid breaking publishing due to doc generation issues), consider using post { success { ... } } or make the doc generation non-blocking with explicit error handling.
This simplifies life for the docs team by allowing them to download the zip of docs.