Skip to content

Commit

Permalink
Merge pull request #4 from jenkins-infra/master
Browse files Browse the repository at this point in the history
Pull in changes from the past 3-4 years
  • Loading branch information
kwhetstone committed Feb 9, 2021
2 parents 9fb3a46 + 7d8d72c commit 363da64
Show file tree
Hide file tree
Showing 13 changed files with 891 additions and 255 deletions.
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2
updates:
- package-ecosystem: maven
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
target-branch: master
reviewers:
- kwhetstone
- MarkEWaite
labels:
- dependencies
ignore:
# the dependency is actually provided by the Web container, hence it is aligned with Jetty. See https://github.com/jenkinsci/jenkins/pull/5211
- dependency-name: "javax.servlet:javax.servlet-api"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
*.iws
.*
!.gitignore
!.github/
secrets/
target/
work
/nbactions.xml
100 changes: 56 additions & 44 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,49 +1,61 @@
stage "Setup"
#!/usr/bin/env groovy


stage "Create Plugin Folder"
//pull in the plugins, save to ./plugins
node {
def mvntool = tool name: 'Maven 3.3.3', type: 'hudson.tasks.Maven$MavenInstallation' //system dependent
def jdktool = tool name: 'Oracle JDK 8u40', type: 'hudson.model.JDK' //system dependent
List customEnv = ["PATH+MVN=${mvntool}/bin", "PATH+JDK=${jdktool}/bin", "JAVA_HOME=${jdktool}/", "MAVEN_HOME=${mvntool}"]
customEnv.add("MAVEN_OPTS=-Dmaven.repo.local=${pwd()}/.m2_repo")

dir('pluginFolder'){
def curdir = pwd()
echo curdir
git changelog: false, poll: false, url:'https://github.com/jenkinsci/backend-extension-indexer.git', branch: 'master'
withEnv(customEnv) {
sh 'mvn clean install -DskipTests'
pipeline {
agent { label 'maven' }
triggers {
cron('H H * * 0')
}
sh "java -verbose:gc -jar ./target/*-bin/extension-indexer*.jar -plugins ${curdir}/plugins"
stash includes: './plugins/*', name: 'plugins'
deleteDir()
}
}

node {
def mvntool = tool name: 'Maven 3.3.3', type: 'hudson.tasks.Maven$MavenInstallation' //system dependent
def jdktool = tool name: 'Oracle JDK 8u40', type: 'hudson.model.JDK' //systeme dependent
List customEnv = ["PATH+MVN=${mvntool}/bin", "PATH+JDK=${jdktool}/bin", "JAVA_HOME=${jdktool}/", "MAVEN_HOME=${mvntool}"]
customEnv.add("MAVEN_OPTS=-Dmaven.repo.local=${pwd()}/.m2_repo")

stage "Generate Documentation"
dir('docFolder'){
git changelog: false, poll: false, url: 'https://github.com/kwhetstone/pipeline-steps-doc-generator.git', branch: 'master'
withEnv(customEnv) {
sh 'mvn clean install -DskipTests'
options {
timestamps()
}
dir('pluings'){
unstash 'plugins'

stages {
stage('Checkout') {
steps {
deleteDir()
checkout scm
}
}

stage('Prepare Indexer') {
steps {
dir('pluginFolder') {
git changelog: false,
poll: false,
url:'https://github.com/jenkinsci/backend-extension-indexer.git',
branch: 'master'
sh 'mvn -s ../settings.xml clean install -DskipTests'
}
}
}

stage('Run Indexer') {
steps {
dir('pluginFolder') {
sh 'java -verbose:gc -jar ./target/*-bin/extension-indexer*.jar -plugins ./plugins && mv plugins ..'
}
}
}

stage('Generate Documentation') {
steps {
dir('docFolder') {
checkout scm
sh 'mvn -s ../settings.xml clean install -DskipTests'
sh 'mv ../plugins . && java -verbose:gc -javaagent:./contrib/file-leak-detector.jar -jar ./target/*-bin/pipeline-steps-doc-generator*.jar'
}
}
}

stage('Clean up') {
steps {
dir('docFolder') {
zip dir: './allAscii', glob: '', zipFile: 'allAscii.zip'
zip dir: './declarative', glob: '', zipFile: 'declarative.zip'
archiveArtifacts artifacts: 'allAscii.zip,declarative.zip', fingerprint: true
}
}
}
}
sh 'java -verbose:gc -jar ./target/*-bin/pipeline-steps-doc-generator*.jar'
}

stage "Archive and Cleanup"
dir('docFolder'){
zip dir: './allAscii', glob: '', zipFile: 'allAscii.zip'
archive 'allAscii.zip'
deleteDir()
}
}
}
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,49 @@
# pipeline-plugin-doc-generator
Creates the documentation for pipeline jobs

## Development

Rough outline of interactive development process:

### Get repositories

You will need

* this repo (`jenkins-infra/pipeline-steps-doc-generator`)
* `jenkins-infra/jenkins.io`
* `jenkinsci/workflow-aggregator-plugin` (as an easy example)

You will need to temporarily patch `jenkins.io` as follows:

```diff
diff --git a/scripts/fetch-external-resources b/scripts/fetch-external-resources
index d3ee8319..cf8e38d2 100755
--- a/scripts/fetch-external-resources
+++ b/scripts/fetch-external-resources
@@ -25,12 +25,6 @@ RESOURCES = [
nil,
nil
],
- [
- 'https://ci.jenkins.io/job/Infra/job/pipeline-steps-doc-generator/job/master/lastSuccessfulBuild/artifact/allAscii.zip',
- 'content/_tmp/allAscii.zip',
- nil,
- 'content/doc/pipeline/steps'
- ],
[
'https://repo.jenkins-ci.org/api/search/versions?g=org.jenkins-ci.main&a=jenkins-core&repos=releases&v=?.*.1',
'content/_data/_generated/lts_baselines.yml',
```

### Create content

From this repository, with others in relative positions:

```bash
rm -v ../jenkins.io/content/doc/pipeline/steps/*.adoc
make -C ../../jenkinsci/workflow-aggregator-plugin/demo copy-plugins
mvn "-Dexec.args=-classpath %classpath org.jenkinsci.pipeline_steps_doc_generator.PipelineStepExtractor -homeDir $(pwd)/../../jenkinsci/workflow-aggregator-plugin/demo -asciiDest $(pwd)/../jenkins.io/content/doc/pipeline/steps -declarativeDest /tmp/declarative" -Dexec.executable=$(which java) org.codehaus.mojo:exec-maven-plugin:3.0.0:exec
make -C ../jenkins.io run
```

Then browse: http://localhost:4242/doc/pipeline/steps/
Binary file added contrib/file-leak-detector.jar
Binary file not shown.
62 changes: 52 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,21 @@

<maven.compiler.testSource>1.8</maven.compiler.testSource>
<maven.compiler.testTarget>1.8</maven.compiler.testTarget>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<compilerArgs>
<arg>-Xlint:deprecation</arg>
<arg>-Xlint:all,-options,-path</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
Expand All @@ -25,6 +36,7 @@
</manifest>
</archive>
</configuration>
<version>3.2.0</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
Expand All @@ -41,59 +53,89 @@
</configuration>
</execution>
</executions>
<version>2.6</version>
</plugin>
</plugins>
</build>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.263.x</artifactId>
<version>23</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>args4j</groupId>
<artifactId>args4j</artifactId>
<version>2.0.16</version>
<version>2.33</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-core</artifactId>
<version>1.651</version>
<version>2.278</version> <!-- for ACL.impersonate2() and acegi to Spring Security conversion -->
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>org.jenkinsci.plugins</groupId>
<artifactId>pipeline-model-extensions</artifactId>
</dependency>
<dependency>
<groupId>net.java.sezpoz</groupId>
<artifactId>sezpoz</artifactId>
<version>1.13</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.7.7</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.13.1</version>
</dependency>
</dependencies>

<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
<url>https://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>

<scm>
<connection>scm:git:git://github.com/jenkinsci/pipeline-plugin-doc-generator.git</connection>
<connection>scm:git:git://github.com/jenkins-infra/pipeline-plugin-doc-generator.git</connection>
<developerConnection>scm:git:ssh://git@github.com/jenkinsci/backend-extension-indexer.git</developerConnection>
</scm>
</project>
34 changes: 34 additions & 0 deletions settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<settings>
<pluginGroups>
<pluginGroup>org.jenkins-ci.tools</pluginGroup>
</pluginGroups>

<profiles>
<!-- Give access to Jenkins plugins -->
<profile>
<id>jenkins</id>
<activation>
<activeByDefault>true</activeByDefault> <!-- change this to false, if you don't like to have it on per default -->
</activation>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<mirrors>
<mirror>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
<mirrorOf>m.g.o-public</mirrorOf>
</mirror>
</mirrors>
</settings>
Loading

0 comments on commit 363da64

Please sign in to comment.