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

[CI] Add enforce maven plugin to do snapshot version check #4157

Merged
merged 1 commit into from
May 25, 2019
Merged

[CI] Add enforce maven plugin to do snapshot version check #4157

merged 1 commit into from
May 25, 2019

Conversation

htynkn
Copy link
Member

@htynkn htynkn commented May 24, 2019

What is the purpose of the change

Creating a jenkins job for deploying snapshot version to apache maven repo.

In order to make everything works well, we need prevent release deploy for this job, so try to add a enforce plugin rule to check all version is snapshot version.

Brief changelog

modify pom.xml and add new enforce plugin

Verifying this change

CI pass with

./mvnw clean validate -Psnapshot-ci-deploy

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a GITHUB_issue field for the change (usually before you start working on it). Trivial changes like typos do not require a GITHUB issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [Dubbo-XXX] Fix UnknownException when host config not exist #XXX. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add sample in dubbo samples project.
  • Run mvn clean install -DskipTests=false & mvn clean test-compile failsafe:integration-test to make sure unit-test and integration-test pass.
  • If this contribution is large, please follow the Software Donation Guide.

@htynkn htynkn requested a review from ralf0131 May 24, 2019 11:31
@ralf0131
Copy link
Contributor

What command does jenkins job run?

@htynkn
Copy link
Member Author

htynkn commented May 24, 2019

Jenkins will run

./mvnw clean validate -Psnapshot-ci-deploy

to check all version are snapshot.

And for deployment, it will run

./mvnw clean package deploy -f dubbo-dependencies-bom && ./mvnw clean package deploy -DskipTests=true

And for commit status check will use a groovy script to do

import groovy.json.JsonSlurper
import java.io.File

def env = System.getenv()
def commitId = env["GIT_COMMIT"]

println "Current commit id: $commitId"

String commitStatusJson = new URL("https://api.github.com/repos/apache/dubbo/commits/$commitId/status").text
println "Commit status: \r\n$commitStatusJson"

def jsonSlurper = new JsonSlurper()
def jsonObject = jsonSlurper.parseText(commitStatusJson)

def status = jsonObject.state

println "Current commit status is $status"

if (status == "sucesss") {
    def newFile = new File("CONTINUE_DEPLOY_FLAG")
    newFile.createNewFile() 
    println "Continue to deploy snapshot"
} else {
    println "Current commit status not allow to deploy snapshot"
}

@ralf0131
Copy link
Contributor

So the Jenkins job workflow is:

  1. check every 30 min
  2. check if the latest commit is built successfully (e.g. CI pass)
  3. check if it is a snapshot version
  4. deploy the snapshot

Is my understanding correct?

@htynkn
Copy link
Member Author

htynkn commented May 25, 2019

So the Jenkins job workflow is:

  1. check every 30 min
  2. check if the latest commit is built successfully (e.g. CI pass)
  3. check if it is a snapshot version
  4. deploy the snapshot

Is my understanding correct?

Yeah. but for the first one, it will check every 6 hours.
For third one, I will add command after this PR merged

Please refer to latest successfully build: https://builds.apache.org/job/Apache%20Dubbo/job/apache-dubbo-snapshot-deployment/16/

The next step I will try to convert this jenkins job config to a Jenkinsfile(https://jenkins.io/doc/book/pipeline/jenkinsfile/), it will make things more clear and easy to maintain. With Jenkinsfile everyone can see Jenkins job config and send a PR to modify it without Apache account and group access

Copy link
Contributor

@ralf0131 ralf0131 left a comment

Choose a reason for hiding this comment

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

LGTM. Please merge it once CI pass.

@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@4c01c5e). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #4157   +/-   ##
=========================================
  Coverage          ?   62.89%           
  Complexity        ?      505           
=========================================
  Files             ?      768           
  Lines             ?    33064           
  Branches          ?     5220           
=========================================
  Hits              ?    20794           
  Misses            ?     9869           
  Partials          ?     2401

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4c01c5e...e12442b. Read the comment docs.

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.

3 participants