-
Notifications
You must be signed in to change notification settings - Fork 16
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
5.0.0-beta.1 incompatible with lightweight checkout in Jenkins #112
Comments
@ciscoo Can you provide more details about how Jenkins lightweight checkout works? I'm presuming the failure you saw was during |
To my understanding, it doesn't checkout the full repo and it's history/branches. Instead, it checks out a specific commit (detached?) which is typically the one that triggered the build. I'm not an expert in this area, a different team manages our CI/CD infrastructure. I've since modified my project's pipeline to do a full checkout as far as I can tell, but it stills fails. Yes, it fails on gitPublishReset. I can provide some redacted logs as to what is happening when I get back into work. |
Here's some more details. Prior to using the beta, my publishing configuration was: gitPublish {
repoUri = "https://github.acmecompany.com/example-org/example.git"
branch = "gh-pages"
contents {
from(layout.buildDirectory.dir("docs"))
into("docs")
}
preserve {
include("**/*")
exclude("docs/**")
}
} Documentation is built with Asciidoctor and versioned. This arrangement has worked fine for a while up until my company introduced Sedated a while ago. When I noticed the change to using the git CLI directly, I migrated quickly. With the beta, I changed the configuration to the following (based on looking at the changes: gitPublish {
branch = "gh-pages"
contents {
from(layout.buildDirectory.dir("docs"))
into("docs")
}
preserve {
include("**/*")
exclude("docs/**")
}
} With this configuration, the logs/commands from a failed run are:
One thing I noticed was the gitPublish {
branch = "gh-pages"
+ repoDir = rootProject.layout.projectDirectory
contents {
from(layout.buildDirectory.dir("docs"))
into("docs")
}
preserve {
include("**/*")
exclude("docs/**")
}
} Which fixes the unnecessary
If I do those commands manually, I get an error:
which makes sense, so removing some redundant portions yields the same error:
|
If you use a full checkout with your old configuration, do you see errors still? Nothing should have changed in v5 that would affect how you configure the extension. gitPublish {
repoUri = "https://github.acmecompany.com/example-org/example.git"
branch = "gh-pages"
contents {
from(layout.buildDirectory.dir("docs"))
into("docs")
}
preserve {
include("**/*")
exclude("docs/**")
}
} Regarding the two changes you made when upgrading to the beta. There are three repositories in use when you use this plugin:
The However, the working repo's git init is intended even if you have a full checkout. It's a separate copy of the repository than your checkout repo, partially because there are some cases where you might publish to a different repo than your code is stored. If the checkout repo's origin remote matches remote repo it will use the checkout repo as a reference, fetching from the checkout repo before fetching from the remote repo to reduce network traffic. If you try to set the With But those are just performance questions. Ultimately, I'd say there's nothing wrong with the original configuration you have. I definitely agree there's a bug in 5.0.0-beta.1, I just need to work out what's needed to account for the lightweight checkout. If you still see an issue with your full checkout and the original |
Old behavior was to use the reference repo (usually the project's checkout repo) as a full remote that we would fetch from. However, Git has a more direct way to reference an existing repo, using `objects/info/alternates`. This mechanism will just let you reuse objects that already exist in the reference repo rather than fetching from the real remotes. So now only origin is a remote and we just try to reuse objects from the remote. This also simplifies things where we had to check if the branch we cared about existed. Now, we don't care and if the objects are relevant they get used and if not, it should be no harm, no foul. This will hopefully address the issue that reported in #112.
@ciscoo 5.0.0-beta.2 is rolling out now with a different implementation of the "reference repo" mechanism which I hope will avoid any issues with a lightweight checkout. Can you try that and let me know if you still see an issue? |
It works again with a full checkout ( Still does not seem to work for lightweight checkout. For more context, here's what Jenkins is doing:
|
That's useful context, though I'm surprised anything in there would cause an issue. Could you provide fresh Gradle output with the error you're receiving on beta.2? |
FYI, I tried recreating this by setting up a repo using the commands from your Jenkins output. So far I wasn't able to cause an error. It's possible I'm missing something (particularly with the spare checkout piece that doesn't seem to do anything). |
I ended up making my own Jenkins install and trying this out on a random project. I did get an error with 5.0.0-beta.1, but 5.0.0-beta.2 worked. This was my test pipeline. Let me know if there's some difference in there that would explain why yours is still failing. pipeline {
agent any
stages {
stage('Publish Docs') {
steps {
checkout scm
sh './gradlew gitPublishPush'
}
}
}
} I'm going to release 5.0.0 (unchanged from 5.0.0-beta.2). If you have more error output or context you can provide let me know. |
Originally posted by @ciscoo in #111 (comment)
Some early feedback from trying out 5.0.0-beta.1, it does not seem to work with the lightweight checkout in Jenkins. Previously it did without issue.
Disabling that and manually cloning the repo yields a different error:
Doing a
git branch -a
before./gradlew gitPublishPush
yields:+ git branch -a * master remotes/origin/HEAD -> origin/master remotes/origin/gh-pages remotes/origin/master
So, to me there is some regression here I think since the previous implementation worked when using grgit/jgit.
The text was updated successfully, but these errors were encountered: