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

Add Drone.io support #141

Merged
merged 4 commits into from
May 8, 2018
Merged

Conversation

donny-dont
Copy link
Contributor

Adds support for Drone.io which has a hosted solution as well as a service implementation.

cc: @bradrydzewski who is the lead on Drone

Copy link
Contributor Author

@donny-dont donny-dont left a comment

Choose a reason for hiding this comment

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

I've been testing by emulating greenkeeper commits at https://beta.drone.io/donny-dont/drone-greenkeeper-test to test the functionality. Should be good to go assuming no additional changes.

* Should update the `package-lock.json`
*/
function shouldUpdate () {
let re = /^(chore|fix)\(package\): update [^ ]+ to version.*$/mi
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Like Codeship there isn't a good way to get back the current number of commits on the branch so here we're matching the commit message. Might be a good feature request for @bradrydzewski at some point.

// Is this a regular build
correctBuild: env.DRONE_BUILD_EVENT=== 'push',
// Should the lockfile be uploaded from this build
uploadBuild: env.DRONE_JOB_NUMBER.endsWith('1')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

With matrix builds the first build is always 1.

// i.e. the Greenkeeper commit
firstPush: shouldUpdate(),
// Is this a regular build
correctBuild: env.DRONE_BUILD_EVENT=== 'push',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Drone has different events for build types in the case of what greenkeeper is up to it would be a push to the branch.

@janl janl self-assigned this Apr 17, 2018
@donny-dont
Copy link
Contributor Author

@janl I wanted to give an update on status.

In my test Greenkeeper just gave me this update donny-dont/drone-greenkeeper-test@master...donny-dont:greenkeeper/sinon-5.0.3 and my Drone plugin went ahead and updated the lockfile and then uploadedthe lockfile.

Here's the definition of the build in the .drone.yml.

pipeline:
  greenkeeper_update_lockfile:
    image: plugins/greenkeeper
    pull: true
    update: true
        
  build:
    image: node:10-alpine
    pull: true
    commands:
      - npm i -g npm@latest
      - npm ci
      
  greenkeeper_lockfile_upload:
    image: plugins/greenkeeper
    upload: true
    secrets: 
      - source: gh_token
        target: gk_token

Anyways I think this is ready to go. Let me know if there's anything else you need me to do.

Copy link
Member

@Realtin Realtin left a comment

Choose a reason for hiding this comment

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

thank you @donny-dont ! 💯 🌴

@Realtin Realtin merged commit a3b997e into greenkeeperio:master May 8, 2018
@greenkeeperio-bot
Copy link
Member

🎉 This PR is included in version 1.15.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants