Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

Basic pipeline for js-ipfs #15

Merged
merged 1 commit into from
Feb 1, 2017
Merged

Basic pipeline for js-ipfs #15

merged 1 commit into from
Feb 1, 2017

Conversation

victorb
Copy link
Collaborator

@victorb victorb commented Feb 1, 2017

Works with branch https://github.com/ipfs/js-ipfs/tree/jenkins-integration

This job config contains the following:

  • Set Github project to github.com/ipfs/js-ipfs
  • Define BranchOrTag parameter for job, which is used to decide what to fetch from SCM
  • Use Jenkinsfile from SCM source

Looks like this in js-ipfs

Dockerfile:

FROM node:6.9.4

WORKDIR /usr/src/app

COPY package.json /usr/src/app/package.json

RUN npm install

COPY . /usr/src/app

CMD ["npm", "run", "test:unit:node"]

Jenkinsfile:

node {
	def VERSION = "latest"
	stage("Checkout") {
		git branch: 'jenkins-integration', url: 'https://github.com/ipfs/js-ipfs.git'
		VERSION = sh(returnStdout: true, script: "git rev-parse HEAD").trim()
	}
	stage("Build") {
		sh "docker build -t quay.io/ipfs/js-ipfs:$VERSION ."
	}
	stage("Test") {
		sh "docker run quay.io/ipfs/js-ipfs:$VERSION"
	}
}

In the future, we'll have docker base-images for all JS projects + shared-libs for the Jenkinsfile so definition would be more similar to this:

node {
  runCheckout(),
  runBuild(),
  runTest()
}

Or even implicit Jenkinsfile if some rule matches.

<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<url>https://github.com/ipfs/js-ipfs</url>
</hudson.plugins.git.UserRemoteConfig>
Copy link

Choose a reason for hiding this comment

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

Is UserRemoteConfig the part that fetches the Jenkinsfile? It's not very obvious that it always takes the Jenkinsfile from master :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, "org.jenkinsci.plugins.workflow" defines how to execute the workflow, UserRemoteConfig defines that the jenkinsfile should be fetched from scm. Right now, it fetches it based on the revision you provide, I'll add a future task to make sure jenkinsfile is fetched from master unless job triggered from a maintainer, or something similar.

@ghost
Copy link

ghost commented Feb 1, 2017

I think this LGTM 👍 UserRemoteConfig could be a bit more expressive

@victorb victorb merged commit 85f8866 into master Feb 1, 2017
@ghost ghost deleted the js-ipfs-job branch February 1, 2017 17:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants