{"action":"created","issue":{"url":"https://api.github.com/repos/ajoberstar/grgit/issues/221","repository_url":"https://api.github.com/repos/ajoberstar/grgit","labels_url":"https://api.github.com/repos/ajoberstar/grgit/issues/221/labels{/name}","comments_url":"https://api.github.com/repos/ajoberstar/grgit/issues/221/comments","events_url":"https://api.github.com/repos/ajoberstar/grgit/issues/221/events","html_url":"https://github.com/ajoberstar/grgit/issues/221","id":311200168,"number":221,"title":"grgit fails on teamcity  ","user":{"login":"SchwiftyRick","id":7405082,"avatar_url":"https://avatars3.githubusercontent.com/u/7405082?v=4","gravatar_id":"","url":"https://api.github.com/users/SchwiftyRick","html_url":"https://github.com/SchwiftyRick","followers_url":"https://api.github.com/users/SchwiftyRick/followers","following_url":"https://api.github.com/users/SchwiftyRick/following{/other_user}","gists_url":"https://api.github.com/users/SchwiftyRick/gists{/gist_id}","starred_url":"https://api.github.com/users/SchwiftyRick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SchwiftyRick/subscriptions","organizations_url":"https://api.github.com/users/SchwiftyRick/orgs","repos_url":"https://api.github.com/users/SchwiftyRick/repos","events_url":"https://api.github.com/users/SchwiftyRick/events{/privacy}","received_events_url":"https://api.github.com/users/SchwiftyRick/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-04-04T12:01:15Z","updated_at":"2018-04-23T13:04:48Z","closed_at":null,"author_association":"NONE","body":"Hi Andrew, I have build a versioning script. It has to switch between two branches (gradleVersioning and feature/gradle). The script has to checkout and push these branches. Running it locally works as designed. On teamcity push fails silently and after second checkout grgit does not recognize changes in my propertiy files. \r\nmy task dependencies:\r\n\r\n```\r\nbuild.finalizedBy artifactoryPublish\r\nartifactoryPublish.finalizedBy updateDev\r\nupdateDev.dependsOn gitCommitToMaster\r\n```\r\n\r\ntask gitCommitToMaster should commit and push changes made prior in the build:\r\n\r\n```\r\ntask gitCommitToMaster {\r\n    group 'gradleVersioning'\r\n    description 'checks out dev branch and commits the new version (-SNAPSHOT cut off) in .s2i and gradle.properties'\r\n    doLast {\r\n        grgit = Grgit.open(dir: '.')\r\n\r\n        grgit.checkout(branch: 'origin/gradleVersioning', createBranch: false)\r\n        grgit.add(patterns: ['gradle.properties', '.s2i/bin'])\r\n\r\n        grgit.commit {\r\n            message = 'automated Gradle Commit'\r\n            all = false\r\n        }\r\n        grgit.tag.add(name: \"V${version}\")\r\n        grgit.push(remote: 'origin', refsOrSpecs: ['gradleVersioning'], tags: true)\r\n        grgit.fetch()\r\n        grgit.pull(remote: 'origin', branch: 'gradleVersioning')\r\n        //grgit.reset(mode: 'hard', commit: 'origin/gradleVersioning')\r\n        grgit.close()\r\n        println \"gitCommitToMaster successful\"\r\n    }\r\n\r\n}\r\n```\r\n\r\ntask updateDev does change the version and then also commits/pushes \r\n\r\n```\r\ntask updateDev {\r\n    group 'gradleVersioning'\r\n    description 'increments the version number and writes it to local project'\r\n    doLast {\r\n        grgit = Grgit.open(dir: '.')\r\n        //grgit.fetch(refSpecs: ['refs/remotes/feature/gradle'])\r\n\r\n        grgit.checkout(branch: 'origin/feature/gradle', createBranch: false)\r\n        //grgit.pull(remote: 'origin', branch: 'feature/gradle')\r\n        versionMap['Minor'] = (versionMap['Minor'] as Integer) + 1\r\n        versionMap['Patch'] = 0\r\n        /*This task will be extended when we switch from basic to semantic versioning*/\r\n        def newVersion = \"${versionMap['Major']}.${versionMap['Minor']}.${versionMap['Patch']}-SNAPSHOT\"\r\n        println \"incremented version for Dev branch: ${newVersion}\"\r\n        try {\r\n            writeToProperties.call(newVersion, \"gradle.properties\")\r\n            writeToProperties.call(newVersion, \".s2i/bin/assemble\")\r\n            println 'writing new version to working directory -> successful'\r\n        }\r\n        catch (IOException ex) {\r\n            println \"gradle.properties in root is not found or locked\"\r\n        }\r\n        println \"start git add, commit and push to DevBranch\"\r\n        grgit.add(patterns: ['gradle.properties', '.s2i/bin'])\r\n        grgit.commit {\r\n            message = 'automated Gradle commit for version update'\r\n            all = false\r\n        }\r\n        grgit.push(remote: 'origin', refsOrSpecs: ['feature/gradle'])\r\n        grgit.reset(mode: 'hard', commit: \"origin/feature/gradle\")\r\n        grgit.close()\r\n        println \"-> was successful\"\r\n\r\n    }\r\n\r\n}\r\n```\r\n\r\nerrorlog:\r\n\r\n```\r\ngitCommitToMaster (1s)\r\n[13:44:14]gitCommitToMaster successful\r\n[13:44:14]:updateDev\r\n[13:44:14]incremented version for Dev branch: 3.1338.0-SNAPSHOT\r\n[13:44:14]write to gradle.properties successful\r\n[13:44:14]write to gradle.properties successful\r\n[13:44:14]writing new version to working directory -> successful\r\n[13:44:14]start git add, commit and push to DevBranch\r\n[13:44:14]\r\n[13:44:14]\r\n[13:44:14]BUILD FAILED\r\n[13:44:14]\r\n[13:44:14]Total time: 1 mins 16.886 secs\r\n[13:44:14]##teamcity[buildProblem identity='-398317399' description='Execution failed for task |':updateDev|'. org.eclipse.jgit.api.errors.TransportException: Nothing to push.' type='gradleBuildProblem']\r\n[13:44:15]Process exited with code 1\r\n[13:44:15]Gradle failure report\r\n[13:44:15]FAILURE: Build failed with an exception.\r\n[13:44:15]\r\n[13:44:15]* Where:\r\n[13:44:15]Build file '/home/tcagent/buildAgent/work/9630fb096086b628/build.gradle' line: 293\r\n[13:44:15]\r\n[13:44:15]* What went wrong:\r\n[13:44:15]Execution failed for task ':updateDev'.\r\n[13:44:15]> Nothing to push.\r\n[13:44:15]\r\n[13:44:15]* Try:\r\n[13:44:15]Run with --info or --debug option to get more log output.\r\n[13:44:15]\r\n[13:44:15]* Exception is:\r\n[13:44:15]org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':updateDev'.\r\n[13:44:15]\tat org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:84)\r\n[13:44:15]\tat org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:55)\r\n[13:44:15]\tat org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)\r\n[13:44:15]\tat org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)\r\n[13:44:15]\tat org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)\r\n[13:44:15]\tat org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:46)\r\n[13:44:15]\tat org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)\r\n[13:44:15]\tat org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)\r\n[13:44:15]\tat org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)\r\n[13:44:15]\tat org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)\r\n[13:44:15]\tat org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:236)\r\n[13:44:15]\tat org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:228)\r\n[13:44:15]\tat org.gradle.internal.Transformers$4.transform(Transformers.java:169)\r\n[13:44:15]\tat org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)\r\n[13:44:15]\tat org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:61)\r\n[13:44:15]\tat org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:228)\r\n[13:44:15]\tat org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:215)\r\n[13:44:15]\tat org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:77)\r\n[13:44:15]\tat org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:58)\r\n[13:44:15]\tat org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:32)\r\n[13:44:15]\tat org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:113)\r\n[13:44:15]\tat org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)\r\n[13:44:15]\tat org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)\r\n[13:44:15]\tat org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)\r\n[13:44:15]\tat org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)\r\n[13:44:15]\tat org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)\r\n[13:44:15]\tat org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)\r\n[13:44:15]\tat org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)\r\n[13:44:15]\tat org.gradle.initialization.DefaultGradleLauncher$3.execute(DefaultGradleLauncher.java:196)\r\n[13:44:15]\tat org.gradle.initialization.DefaultGradleLauncher$3.execute(DefaultGradleLauncher.java:193)\r\n[13:44:15]\tat org.gradle.internal.Transformers$4.transform(Transformers.java:169)\r\n[13:44:15]\tat org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)\r\n[13:44:15]\tat org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56)\r\n[13:44:15]\tat org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:193)\r\n[13:44:15]\tat org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:119)\r\n[13:44:15]\tat org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:102)\r\n[13:44:15]\tat org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:71)\r\n[13:44:15]\tat org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)\r\n[13:44:15]\tat org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)\r\n[13:44:15]\tat org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)\r\n[13:44:15]\tat org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)\r\n[13:44:15]\tat org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75)\r\n[13:44:15]\tat org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49)\r\n[13:44:15]\tat org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:44)\r\n[13:44:15]\tat org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:29)\r\n[13:44:15]\tat org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)\r\n[13:44:15]\tat org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:173)\r\n[13:44:15]\tat org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:244)\r\n[13:44:15]\tat org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:217)\r\n[13:44:15]\tat org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:33)\r\n[13:44:15]\tat org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)\r\n[13:44:15]\tat org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)\r\n[13:44:15]\tat org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)\r\n[13:44:15]\tat org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:210)\r\n[13:44:15]\tat org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:174)\r\n[13:44:15]\tat org.gradle.launcher.Main.doAction(Main.java:33)\r\n[13:44:15]\tat org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)\r\n[13:44:15]\tat org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:60)\r\n[13:44:15]\tat org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:37)\r\n[13:44:15]\tat org.gradle.launcher.GradleMain.main(GradleMain.java:23)\r\n[13:44:15]\tat org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:31)\r\n[13:44:15]\tat org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:108)\r\n[13:44:15]\tat org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)\r\n[13:44:15]Caused by: org.eclipse.jgit.api.errors.TransportException: Nothing to push.\r\n[13:44:15]\tat org.eclipse.jgit.api.PushCommand.call(PushCommand.java:180)\r\n[13:44:15]\tat org.eclipse.jgit.api.PushCommand.call(PushCommand.java:85)\r\n[13:44:15]\tat java_util_concurrent_Callable$call$0.call(Unknown Source)\r\n[13:44:15]\tat org.ajoberstar.grgit.operation.PushOp.call(PushOp.groovy:85)\r\n[13:44:15]\tat org.ajoberstar.grgit.operation.PushOp.call(PushOp.groovy)\r\n[13:44:15]\tat java_util_concurrent_Callable$call.call(Unknown Source)\r\n[13:44:15]\tat java_util_concurrent_Callable$call.call(Unknown Source)\r\n[13:44:15]\tat org.ajoberstar.grgit.internal.OpSyntax.mapOperation(OpSyntax.groovy:33)\r\n[13:44:15]\tat org.ajoberstar.grgit.internal.OpSyntax$mapOperation.callStatic(Unknown Source)\r\n[13:44:15]\tat org.ajoberstar.grgit.Grgit.push(Grgit.groovy)\r\n[13:44:15]\tat org.ajoberstar.grgit.Grgit$push$4.call(Unknown Source)\r\n[13:44:15]\tat build_4vt9fauifmm8g0g715qp7omw0$_run_closure17$_closure35.doCall(/home/tcagent/buildAgent/work/9630fb096086b628/build.gradle:293)\r\n[13:44:15]\tat org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:596)\r\n[13:44:15]\tat org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:577)\r\n[13:44:15]\tat org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:95)\r\n[13:44:15]\tat org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:76)\r\n[13:44:15]\t... 62 more\r\n[13:44:15]Caused by: org.eclipse.jgit.errors.TransportException: Nothing to push.\r\n[13:44:15]\tat org.eclipse.jgit.transport.Transport.push(Transport.java:1332)\r\n[13:44:15]\tat org.eclipse.jgit.api.PushCommand.call(PushCommand.java:169)\r\n[13:44:15]\t... 77 more\r\n```"},"comment":{"url":"https://api.github.com/repos/ajoberstar/grgit/issues/comments/383567654","html_url":"https://github.com/ajoberstar/grgit/issues/221#issuecomment-383567654","issue_url":"https://api.github.com/repos/ajoberstar/grgit/issues/221","id":383567654,"user":{"login":"SchwiftyRick","id":7405082,"avatar_url":"https://avatars3.githubusercontent.com/u/7405082?v=4","gravatar_id":"","url":"https://api.github.com/users/SchwiftyRick","html_url":"https://github.com/SchwiftyRick","followers_url":"https://api.github.com/users/SchwiftyRick/followers","following_url":"https://api.github.com/users/SchwiftyRick/following{/other_user}","gists_url":"https://api.github.com/users/SchwiftyRick/gists{/gist_id}","starred_url":"https://api.github.com/users/SchwiftyRick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SchwiftyRick/subscriptions","organizations_url":"https://api.github.com/users/SchwiftyRick/orgs","repos_url":"https://api.github.com/users/SchwiftyRick/repos","events_url":"https://api.github.com/users/SchwiftyRick/events{/privacy}","received_events_url":"https://api.github.com/users/SchwiftyRick/received_events","type":"User","site_admin":false},"created_at":"2018-04-23T13:04:48Z","updated_at":"2018-04-23T13:04:48Z","author_association":"NONE","body":"Regarding the first issue you were right. It was indeed due to a pre-recieve webhook.\r\nI added task: \r\ntask pushToGit(type: Exec) {\r\n\r\n    workingDir '.'\r\n    commandLine 'git', 'push', 'origin', 'gradleVersioning'\r\n\r\n}\r\n\r\nwhich then showed me a 401 in the log.\r\nUnfortunately, your new version is not in our artifactory but will give it a try at home.\r\nThank you"}}
{"actor":{"display_login":"SchwiftyRick"}}