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

Clean repo: marked as not clean #95

Closed
tvschuer opened this issue Jul 9, 2018 · 6 comments
Closed

Clean repo: marked as not clean #95

tvschuer opened this issue Jul 9, 2018 · 6 comments

Comments

@tvschuer
Copy link

tvschuer commented Jul 9, 2018

Hi

I've been trying to get this plugin working for me, without success.

gradle:

plugins {
  id 'org.ajoberstar.reckon' version '0.8.0'
}

apply plugin: "java"
apply plugin: "jacoco"

reckon {
  scopeFromProp()
  stageFromProp('milestone', 'rc', 'final')
}
reckonTagCreate.dependsOn check
  • git shows no local modification, and and one pending commit (same behaviour if everything is pushed)
git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean
  • git repo has no tags
Could not evaluate onlyIf predicate for task ':reckonTagCreate'.
> Cannot release a final or significant stage without a clean repo.

* Try:
Run with --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.GradleException: Could not evaluate onlyIf predicate for task ':reckonTagCreate'.
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:44)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:623)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:578)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.lang.IllegalStateException: Cannot release a final or significant stage without a clean repo.
        at org.ajoberstar.reckon.core.Reckoner.reckon(Reckoner.java:54)
        at org.ajoberstar.reckon.gradle.ReckonExtension.reckonVersion(ReckonExtension.java:79)
        at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:166)
        at org.ajoberstar.reckon.gradle.ReckonPlugin$DelayedVersion.getVersion(ReckonPlugin.java:82)
        at org.ajoberstar.reckon.gradle.ReckonPlugin.lambda$createTagTask$2(ReckonPlugin.java:44)
        at org.gradle.api.specs.AndSpec.isSatisfiedBy(AndSpec.java:47)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:42)
        ... 19 more

DEBUG logs show the git repo being detected correctly:

12:39:01.218 [DEBUG] [org.ajoberstar.reckon.core.GitInventorySupplier] Found HEAD commit AnyObjectId[0a4661c5281efbc1f3305d21c439a751ef2d9ada]
12:39:01.223 [DEBUG] [org.ajoberstar.reckon.core.GitInventorySupplier] Found tagged versions: []

As far as I can tell from the code, the git repo is marked as not clean. But I have no idea why.
Even if I have everything pushed to origin, I still get the same output.

@ajoberstar
Copy link
Owner

This is probably a difference between JGit and C Git. If you add a little task to print out the status from Grgit, you should see what it thinks is modified:

task status {
  doLast {
    println grgit.status()
  }
}

@tvschuer
Copy link
Author

Great, that was indeed the case!

I had a subfolder with its own git repo.
Once I removed the subfolder, my cmd line git did mark the subfolder as removed. After committing the changes, I finally got my version working!

Thx!

@ghost
Copy link

ghost commented Sep 3, 2019

Hi,

Im having the same issue when using reckon as part of a Jenkins pipeline. I have tried to add the task status as above, but that does not execute before the pipeline fails. When I run the status task locally the repo appears clean. I have tried to clean the repo using commits such as git clean and so on, but it is still failing. Would you be able to suggest what might fix this?

plugins {
    id 'org.ajoberstar.reckon' version '0.9.0'
}

apply plugin: 'java'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'org.ajoberstar.reckon'
reckon {
    reckon.scopeFromProp()
    reckon.stageFromProp('dev', 'rc', 'final')
}
reckonTagCreate.dependsOn check

Thank you

@sschuberth
Copy link

In my case the cause was an untracked file in a submodule. While I have ignore = untracked in .gitmodules, that setting seems to be ignored by JGit and only honored by the regular Git command line client. So for me the solution was to clean up the working tree of the submodule with the regular Git command line client before executing reckon.

@ghost
Copy link

ghost commented Sep 3, 2019

Thank you for your answer. I found the problem, there was a file being produced during the pipeline which I wasn't seeing - just had to add it to the .gitignore file and it worked great.

@andysworkshop
Copy link

jgit doesn't play well with cygwin and filemodes. It decided that my gradlew script had changed (filemode 0755 on cygwin) when it hadn't. I had to temporarily set core.filemode = false to run reckon in final mode.

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

No branches or pull requests

4 participants