rhd-gitops-example / services

Intra-Git repository promotions for GitOps.
Apache License 2.0
7 stars 8 forks source link

Fix automerge PipelineResources for Tekton 0.12 #102

Closed mnuttall closed 4 years ago

mnuttall commented 4 years ago

Also fixes standalone Task for git name and email, which had been dropped accidentally.

Resolves https://github.com/rhd-gitops-example/services/issues/83

a-roberts commented 4 years ago

Trying this now, confident the git commit bit is fine, yet to try with the refs stuff

a-roberts commented 4 years ago

I pinged this to Mark on Slack but for posterity here's what I see - my PR gets closed and the branch deleted, notice the fatal error.

It's weird because the PR I refer to can be merged through the UI so there are no conflicts. It's https://github.com/a-roberts/gitops-example-dev/pull/20


[do-this-first : git-source-gitops-repo-t84fp] {"level":"info","ts":1591362971.0707572,"caller":"git/git.go:136","msg":"Successfully cloned https://github.com/a-roberts/gitops-example-dev @ somebigstringstartingwithad (grafted, HEAD -> master, origin/master) in path /workspace/git-source"}
[do-this-first : git-source-gitops-repo-t84fp] {"level":"info","ts":1591362971.1682613,"caller":"git/git.go:177","msg":"Successfully initialized and updated submodules in path /workspace/git-source"}

[do-this-first : pr-source-pull-request-qxv8g] {"level":"info","ts":1591362971.3291252,"caller":"pullrequest-init/main.go:56","msg":"RUNNING DOWNLOAD!","resource_type":"pullrequest","mode":"download"}
[do-this-first : pr-source-pull-request-qxv8g] {"level":"info","ts":1591362971.3292298,"caller":"pullrequest/api.go:54","msg":"finding pr","resource_type":"pullrequest","mode":"download","provider":"github","owner":"a-roberts","repo":"gitops-example-dev","pr":"20"}
[do-this-first : pr-source-pull-request-qxv8g] {"level":"info","ts":1591362972.0826116,"caller":"pullrequest/api.go:61","msg":"finding combined status","resource_type":"pullrequest","mode":"download","provider":"github","owner":"a-roberts","repo":"gitops-example-dev","pr":"20"}
[do-this-first : pr-source-pull-request-qxv8g] {"level":"info","ts":1591362972.2487624,"caller":"pullrequest/api.go:72","msg":"finding comments: %v&{0xc0000a8c60 a-roberts/gitops-example-dev 20 0xc000098528}","resource_type":"pullrequest","mode":"download","provider":"github","owner":"a-roberts","repo":"gitops-example-dev","pr":"20"}
[do-this-first : pr-source-pull-request-qxv8g] {"level":"info","ts":1591362972.4182959,"caller":"pullrequest/api.go:77","msg":"found comments: %v[]","resource_type":"pullrequest","mode":"download","provider":"github","owner":"a-roberts","repo":"gitops-example-dev","pr":"20"}

[do-this-first : check-yaml] serviceaccount/default-main-service-account created (dry run)
[do-this-first : check-yaml] service/nginx-service created (dry run)
[do-this-first : check-yaml] deployment.apps/nginx-deployment created (dry run)

[do-this-first : merge-pr] ++ yq r pull-request/pr.json Link
[do-this-first : merge-pr] + fullPRLink=https://github.com/a-roberts/gitops-example-dev/pull/20.diff
[do-this-first : merge-pr] + prURL=https://github.com/a-roberts/gitops-example-dev/pull/20
[do-this-first : merge-pr] + git config --global user.name a-roberts
[do-this-first : merge-pr] + git config --global user.email myemail
[do-this-first : merge-pr] + cd git-source
[do-this-first : merge-pr] + hub merge https://github.com/a-roberts/gitops-example-dev/pull/20
[do-this-first : merge-pr] From https://github.com/a-roberts/gitops-example-dev
[do-this-first : merge-pr]  * branch            refs/pull/20/head -> FETCH_HEAD
[do-this-first : merge-pr] fatal: refusing to merge unrelated histories
[do-this-first : merge-pr] + git push -u origin master
[do-this-first : merge-pr] Everything up-to-date
[do-this-first : merge-pr] Branch 'master' set up to track remote branch 'master' from 'origin'.
[do-this-first : merge-pr] ++ yq r /workspace/pull-request/pr.json Head.Ref
[do-this-first : merge-pr] + prBranch=workspace-repo-local-dir-07055
[do-this-first : merge-pr] + git push origin --delete workspace-repo-local-dir-07055
[do-this-first : merge-pr] To https://github.com/a-roberts/gitops-example-dev
[do-this-first : merge-pr]  - [deleted]         workspace-repo-local-dir-07055
mnuttall commented 4 years ago

Added a [WIP] indicator to the PR subject - need to debug.

mnuttall commented 4 years ago

Setting depth=0 in the Git PipelineResource fixes the error,

Automatic merge failed; fix conflicts and then commit the result.