@atomist/sdm-pack-jenkins v0.1.0-master.20190604195525
@atomist/sdm-pack-jenkins
An extension Pack for an Atomist SDM to integrate with Jenkins for converging Job definitions and triggering jobs/build/pipelines as part of an Atomist SDM goal set.
The following code sample shows the Jenkins
goal being used in a simple
SDM from our samples:
/**
* Main entry point into the SDM
*/
export const configuration = configure(async () => {
// The Jenkins goal needs access to the Jenkins master which
// can be configured below
const options: Pick<JenkinsRegistration, "server"> = {
server: {
url: process.env.JENKINS_URL || "http://127.0.0.1:8080",
user: process.env.JENKINS_USER || "admin",
password: process.env.JENKINS_PASSWORD || "123456",
},
};
// Jenkins goal that runs a job named <repo_name>-build which will be
// created or updated with a job definition returned by the mavenPipeline
// function
const build = jenkinsRun("build", {
...options,
job: async gi => `${gi.goalEvent.repo.name}-build`,
definition: async gi => mavenPipeline(gi),
});
// Single push rule that runs the build goal when the push is material and the project
// has a pom.xml file
return {
"ci/cd": {
test: [
hasFile("pom.xml"),
isMaterialChange({
extensions: ["java", "properties", "yaml"],
files: ["pom.xml"],
})],
goals: [
build,
],
},
};
}, { name: "jenkins" });
/**
* Load the job definition from a local XML template
*/
async function mavenPipeline(gi: GoalInvocation): Promise<string> {
const template = (await fs.readFile(path.join(__dirname, "maven.pipeline.xml"))).toString();
const hb = hbx.compile(template);
return hb({ gi });
}
Software delivery machines enable you to control your delivery process in code. Think of it as an API for your software delivery. See the Atomist documentation for more information on the concept of a software delivery machine and how to create and develop an SDM.
Getting started
See the Developer Quick Start to jump straight to creating an SDM.
Contributing
Contributions to this project from community members are encouraged and appreciated. Please review the Contributing Guidelines for more information. Also see the Development section in this document.
Code of conduct
This project is governed by the Code of Conduct. You are expected to act in accordance with this code by participating. Please report any unacceptable behavior to code-of-conduct@atomist.com.
Documentation
Please see docs.atomist.com for developer documentation.
Connect
Follow @atomist and The Composition blog related to SDM.
Support
General support questions should be discussed in the #support
channel in the Atomist community Slack workspace.
If you find a problem, please create an issue.
Development
You will need to install Node.js to build and test this project.
Build and test
Install dependencies.
$ npm install
Use the build
package script to compile, test, lint, and build the
documentation.
$ npm run build
Release
Releases are handled via the Atomist SDM. Just press the 'Approve' button in the Atomist dashboard or Slack.
Created by Atomist. Need Help? Join our Slack workspace.
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago