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

Job commit is not being created #22

Closed
josecelano opened this issue Apr 6, 2022 · 4 comments · Fixed by #23, #24 or #27
Closed

Job commit is not being created #22

josecelano opened this issue Apr 6, 2022 · 4 comments · Fixed by #23, #24 or #27
Labels
bug Something isn't working

Comments

@josecelano
Copy link
Member

When the library changes (a new commit is created) the queue job commit is not being created:

https://github.com/Nautilus-Cyberneering/library-consumer/runs/5850529993?check_suite_focus=true#step:8:18

I'm going to find out first if it's actually not created or only a problem assigning outputs.

@josecelano josecelano added the bug Something isn't working label Apr 6, 2022
@josecelano josecelano linked a pull request Apr 6, 2022 that will close this issue
@josecelano
Copy link
Member Author

The commit is created. There must be something wrong when we assign the commit hash to the output variable.

@josecelano josecelano reopened this Apr 6, 2022
@josecelano
Copy link
Member Author

I'm debugging following these steps:

  1. I've just copied the v1-beta release into this repo as an embedded action
  2. I want to add some console logs to see what SimpleGit is returning after the commit.

I'm running the workflow locally with act with:

./bin/act -W .github/workflows/work-allocator.yml -j update

By the way, act has released a new version that supports node 16.

I got this strange error in the checkout action:

| Cloning into '/home/josecelano/Documents/github/Nautilus-Cyberneering/library-consumer/libraries/aaa'...
| fatal: Needed a single revision
| Unable to find current origin/master revision in submodule path 'libraries/aaa'

It seems the submodule update was trying to use the master branch and we are using the main one. I fixed it by modifying the .gitsubmodule config file:

[submodule "libraries/aaa"]
	path = libraries/aaa
	url = https://github.com/josecelano/library-aaa
	branch = main

The output from SinpleGit is:

{
  author: {
    email: 'bot@nautilus-cyberneering.de',
    name: 'NautilusCyberneering[bot]'
  },
  branch: 'issue-22-job-commit-not-created',
  commit: 'df462c39',
  root: false,
  summary: { changes: 0, insertions: 0, deletions: 0 }
}

And this is the commit:

commit df462c39c7d88831a066869270c7b065b5945c18 (HEAD -> 
32missue-22-job-commit-not-created)
Author:     NautilusCyberneering[bot] <bot@nautilus-cyberneering.de>
AuthorDate: Fri Apr 8 09:33:56 2022 +0000
Commit:     A <committer@example.com>
CommitDate: Fri Apr 8 09:33:56 2022 +0000

    📝🈺: Library Update [library-aaa]
    
    Update Library Submodule and Process Changes:
    https://github.com/josecelano/library-aaa/commit/c799c8618feb037a7c0ecc9d2af
ee58094f57f9e
    ->
    https://github.com/josecelano/library-aaa/commit/dbfdc21437889d8f4fa56b10c03
8bf8c0d9292a0     

    PREVIOUS_REF=c799c8618feb037a7c0ecc9d2afee58094f57f9e
    CURRENT_REF=dbfdc21437889d8f4fa56b10c038bf8c0d9292a0
fatal: unrecognized argument: --no-commit-hash--

And I finally found the problem. In this method:

  findByShortCommitHash(shortCommitHash: ShortCommitHash): CommittedMessage {
    const commits = this.messages.filter(message => {
      console.log("equals to", message.shortCommitHash(), shortCommitHash)
      message.shortCommitHash().equalsTo(shortCommitHash)
    })

    if (commits.length === 0) {
      return nullMessage()
    }

    return commits[0]
  }

We always assume the short commit hash to be 7 chars and the one SinpleGit is returning has 8 chars.

This comparison is not working because of the missing '8' char at the end.

 equals to ShortCommitHash { value: 'ce02a4d' } ShortCommitHash { value: 'ce02a4d8' }

This bug affects this issue @yeraydavidrodriguez

Besides, I was talking to @da2ce7 yesterday and we want to modify the commit to get the full hash using git commit-tree.

I can understand why the unit test is working in the git-queue but I have to find out why the e2e did not fail. Besides, it seems 7-char length for the short hash is not a standard. For some reason in this repo has changed from 7 to 8.

Since we were using a Beta version I think we could fix this issue just by not using short hashes anymore. We can also fix this version by allowing different sizes for short hashes. That would be easy to fix, I think.

@da2ce7
Copy link
Collaborator

da2ce7 commented Apr 8, 2022

@josecelano

I can understand why the unit test is working in the git-queue but I have to find out why the e2e did not fail. Besides, it seems 7-char length for the short hash is not a standard. For some reason in this repo has changed from 7 to 8.

Please remember that the git short hashes are variable length:

--short[=length]

Same as --verify but shortens the object name to a unique prefix with at least length characters. The minimum length is 4, the default is the effective value of the core.abbrev configuration variable (see git-config[1]).

josecelano added a commit that referenced this issue Apr 8, 2022
becuase the git short commit length changed from 7 chars to 8.:
@josecelano josecelano linked a pull request Apr 8, 2022 that will close this issue
josecelano added a commit that referenced this issue Apr 8, 2022
becuase the git short commit length changed from 7 chars to 8.:
josecelano added a commit to nautilus-cyberneering/git-queue that referenced this issue Apr 13, 2022
Bug external project: nautilus-cyberneering/library-consumer#22
Issue: #123

The bug was temporarily fixes but setting git config with:

git config --global core.abbrev 7

We do not need it anymore becuase SimpleGit has force commit hash length
to the maximum (40 chararters). So we only use full hashes.
josecelano added a commit to nautilus-cyberneering/git-queue that referenced this issue Apr 13, 2022
Bug external project: nautilus-cyberneering/library-consumer#22
Internal issue: #123

The bug was temporarily fixed by setting git config to:

git config --global core.abbrev 7

We do not need it anymore becuase SimpleGit has force commit hash length
to the maximum (40 chararters). So we only use full hashes.
@josecelano
Copy link
Member Author

We can remove the patch using a newer version of GitQueue when this PR is merged.

That means we do not need anymore this patch in the workflows:

- name: Set the length for git short commit hashes
  run: |
    # Why do we need this? https://github.com/Nautilus-Cyberneering/library-consumer/issues/22
    # https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreabbrev
    git config --global core.abbrev 7

@josecelano josecelano reopened this Apr 13, 2022
da2ce7 pushed a commit to nautilus-cyberneering/git-queue that referenced this issue Apr 13, 2022
Bug external project: nautilus-cyberneering/library-consumer#22
Internal issue: #123

The bug was temporarily fixed by setting git config to:

git config --global core.abbrev 7

We do not need it anymore becuase SimpleGit has force commit hash length
to the maximum (40 chararters). So we only use full hashes.
josecelano added a commit to nautilus-cyberneering/git-queue that referenced this issue Apr 18, 2022
Bug external project: nautilus-cyberneering/library-consumer#22
Internal issue: #123

The bug was temporarily fixed by setting git config to:

git config --global core.abbrev 7

We do not need it anymore becuase SimpleGit has force commit hash length
to the maximum (40 chararters). So we only use full hashes.
josecelano added a commit to nautilus-cyberneering/git-queue that referenced this issue Apr 18, 2022
Bug external project: nautilus-cyberneering/library-consumer#22
Internal issue: #123

The bug was temporarily fixed by setting git config to:

git config --global core.abbrev 7

We do not need it anymore becuase SimpleGit has force commit hash length
to the maximum (40 chararters). So we only use full hashes.
josecelano added a commit to nautilus-cyberneering/git-queue that referenced this issue Apr 18, 2022
Bug external project: nautilus-cyberneering/library-consumer#22
Internal issue: #123

The bug was temporarily fixed by setting git config to:

git config --global core.abbrev 7

We do not need it anymore becuase SimpleGit has force commit hash length
to the maximum (40 chararters). So we only use full hashes.
@josecelano josecelano linked a pull request Jun 10, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants