質問

I'm trying out Jenkins release staging functionality with the Artifactory plugin:

Here is a summary of what is happening. Everything is correct except for the error on the last item:

  • Changes the version in gradle.properties from 1.0.1-SNAPSHOT to 1.0.1
  • Builds successfully.
  • Deploys artifacts to a local artifactory server
  • Creates a git release branch 'REL-BRANCH-1.0.1c'
  • Commits the version change in gradle.properties. Pushes it to git server.
  • Then Jenkins errors on git checkout master.

This same command works fine on a local clone of the git repo. 'master' is the correct name of the normal dev branch on this test project. I can't imagine why this wouldn't work.

FYI, this is a test project using temporary servers running on my development laptop.

Here is the Jenkins console output:

:my-great-lib:artifactoryPublish
Deploying artifact: http://localhost:8081/artifactory/libs-release-local/org/gradle/sample/my-great-app/1.0.1/my-great-app-1.0.1-sources.jar
Deploying artifact: http://localhost:8081/artifactory/libs-release-local/org/gradle/sample/my-great-app/1.0.1/my-great-app-1.0.1.pom
Deploying artifact: http://localhost:8081/artifactory/libs-release-local/org/gradle/sample/my-great-app/1.0.1/my-great-app-1.0.1.jar
Deploying artifact: http://localhost:8081/artifactory/libs-release-local/org/gradle/sample/my-great-lib/1.0.1/my-great-lib-1.0.1-sources.jar
Deploying artifact: http://localhost:8081/artifactory/libs-release-local/org/gradle/sample/my-great-app/1.0.1/my-great-app-1.0.1-javadoc.jar
Deploying artifact: http://localhost:8081/artifactory/libs-release-local/org/gradle/sample/my-great-lib/1.0.1/my-great-lib-1.0.1.pom
Deploying artifact: http://localhost:8081/artifactory/libs-release-local/org/gradle/sample/my-great-lib/1.0.1/my-great-lib-1.0.1-javadoc.jar
Deploying artifact: http://localhost:8081/artifactory/libs-release-local/org/gradle/sample/my-great-lib/1.0.1/my-great-lib-1.0.1.jar
Deploying build info to: http://localhost:8081/artifactory/api/build

BUILD SUCCESSFUL

Total time: 6.243 secs
Build step 'Invoke Gradle script' changed build result to SUCCESS
[RELEASE] Committing release version on branch 'REL-BRANCH-1.0.1c'
[RELEASE] Pushing branch 'REL-BRANCH-1.0.1c' to 'ssh://git@localhost:7999/test/atest.git'
Failure in post build SCM action: Failed checkout branch: Command "git checkout master" returned status code 1:
stdout: 
stderr: error: pathspec 'master' did not match any file(s) known to git.

ERROR: [RELEASE] Failed on build completion
java.io.IOException: Failed checkout branch: Command "git checkout master" returned status code 1:
stdout: 
stderr: error: pathspec 'master' did not match any file(s) known to git.

    at org.jfrog.hudson.release.scm.git.GitManager$CheckoutBranchCallable.invoke(GitManager.java:234)
    at org.jfrog.hudson.release.scm.git.GitManager$CheckoutBranchCallable.invoke(GitManager.java:199)
    at hudson.FilePath.act(FilePath.java:914)
    at hudson.FilePath.act(FilePath.java:887)
    at org.jfrog.hudson.release.scm.git.GitManager.checkoutBranch(GitManager.java:60)
    at org.jfrog.hudson.release.scm.git.GitCoordinator.buildCompleted(GitCoordinator.java:137)
    at org.jfrog.hudson.gradle.ArtifactoryGradleConfigurator$ReleaseRunListener.onCompleted(ArtifactoryGradleConfigurator.java:674)
    at org.jfrog.hudson.gradle.ArtifactoryGradleConfigurator$ReleaseRunListener.onCompleted(ArtifactoryGradleConfigurator.java:644)
    at hudson.model.listeners.RunListener.fireCompleted(RunListener.java:199)
    at hudson.model.Run.execute(Run.java:1726)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:231)
Finished: FAILURE
役に立ちましたか?

解決

Enable verbose logging using set ANT_ARGS=-d

Then you should be able to understand the directory in which it tries the checkout operation. Goto that directory and see if the repository is cloned there ?

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top