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

If git fails to push, it will not stop retrying #89

Open
dimaj opened this issue Feb 12, 2019 · 3 comments
Open

If git fails to push, it will not stop retrying #89

dimaj opened this issue Feb 12, 2019 · 3 comments

Comments

@dimaj
Copy link

dimaj commented Feb 12, 2019

Had a situation, where the user that was pushing to our git repo didn't have push rights to a restricted branch. As a result, the step was running over and over again. There was no helpful information as to what was happening.

I think it would be nice if errors from git were surfaced to the logs and retry had a limit.

@Gregro
Copy link

Gregro commented Jan 29, 2020

What do you mean that "the step was running over and over again"? In our case, Concourse doesn't have permission to write to develop where src/version.txt is.

However, the put step lights up green. Also, the version number keeps incrementing in subsequent jobs -- I assume this gets cached in the resource?

Since we have no idea the git push failures are happening, if something ever wipes the state in Concourse, our version number would get reset.

Configuration (Concourse v 5.7.0) is:

resources:
- name: library-version
  type: semver
  source:
    branch: develop
    driver: git
    file: src/version.txt
    private_key: ((bitbucket-repo-private-key))
    uri: ssh://git@domain:1234/project/repo.git

jobs:
- name: job-build-packages
  serial: true
  plan:
  - get: library-version
    params:
      bump: patch
  - put: library-version
    params:
      file: library-version/version

Output of put step:

Cloning into '/tmp/semver-git-repo'...
Warning: Permanently added '[domain]:1234,[127.0.0.1]:1234' (RSA) to the list of known hosts.
HEAD is now at abcd987 latest-commit-message-here
From ssh://domain:1234/project/repo
 * branch            develop    -> FETCH_HEAD
HEAD is now at abcd987 latest-commit-message-here
From ssh://domain:1234/project/repo
 * branch            develop    -> FETCH_HEAD
HEAD is now at abcd987 latest-commit-message-here

The contents of src/version.txt remain at 1.3.0, but subsequent runs of the pipeline have this in the get: library-version step:
bumped locally from 1.3.5 to 1.3.6
bumped locally from 1.3.6 to 1.3.7

@dimaj
Copy link
Author

dimaj commented Jan 29, 2020

I was seeing messages like these: #38 (comment)

And job would not terminate.
I am pretty sure that PR #92 fixed the issue, but I need to verify it. Let me try to find some time to verify it and report back.

Also, when you say that

Concourse doesn't have permission to write to develop where src/version.txt is.

how can you guarantee that? What will happen if you were to do this:

$ cd git_repo
$ export GIT_SSH_COMMAND='ssh -i /path/to/your/private/key/referenced/in/pipeline'
$ echo testing > src/testing
$ git add testing
$ git commit testing -m "testing git pushes"
$ git push origin develop

Will that push your commit or will it be denied?

@ringods
Copy link

ringods commented Mar 2, 2021

We have manually triggered jobs to bump to a new major, minor or patch version. The semver resource has 0.0.1 as the initial version, git as the driver and an SSH access key to Bitbucket Cloud. But we overlooked that an SSH access key on Bitbucket Cloud only provides read access to the repository.

Below you can see two green runs of the minor version bump:

Screenshot 2021-03-02 at 13 59 07

The job reports success, but the push to Bitbucket Cloud clearly fails. This kind of error should be reported as an error in the job as well IMO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants