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

IndexError: list index out of range - AT runid = commitMessageArray[2] #37

Closed
joshuadmatthews opened this issue Nov 8, 2022 · 6 comments

Comments

@joshuadmatthews
Copy link
Contributor

joshuadmatthews commented Nov 8, 2022

I was not seeing the dispatch event on deploy completion, so went to the logs and noticed there is an index out of range error where it tries to fetch the runid/commitId.

    def _get_source_commit_id_run_id(self, manifest_commitid):
        commitMessage = self.git_repository.get_commit_message(manifest_commitid)
        commitMessageArray = commitMessage.split('/', 5)
        runid = commitMessageArray[2]
        commitid = commitMessageArray[3]
        logging.info(f'CommitId {commitid}')
        return commitid, runid

Looks like it is expecting a commit message to exist on the manifest update commit with these values. I haven't seen that documented anywhere though, and in my case I am using flux image automation to automatically update manifests when a new image hits the container registry, so I don't think I will have any easy way to generate this commit message from flux.

@joshuadmatthews
Copy link
Contributor Author

Also, I think assuming that there is only a single runId/commitId behind a manifest commit is not a good assumption. In my workflows there are dozens of different services owned by different teams each with their own workflows to publish containers. If multiple services updates happen at the same time, they may be picked up as a group by flux image automation controller and the manifests are updated in a single commit.

In order to make a gitops connector flow work, I need to pass an array of runIds and commitId that represent all of the container images updated in this manifest commit. Then the publish workflow would then use these arrays to package up all of the necessary services.

@eedorenko
Copy link
Collaborator

Yes, gitops connector expects a commit message to exist in the manifests commit. Agree, it should be documented explicitly. GitOps connector "dispatch event" functionality is supposed to work in the flows similar to this one - tutorial.

@joshuadmatthews
Copy link
Contributor Author

joshuadmatthews commented Nov 11, 2022

I think it would be more flexible with error handling in case the message isn’t in the expected format,

also would be great if there was a third parameter sent that contains the whole commit message without parsing, this would allow user to pass whatever data is necessary through the commit message.

@eedorenko
Copy link
Collaborator

Agree! PRs are welcome :)

@joshuadmatthews
Copy link
Contributor Author

Sure will give it a try. I’m not too familiar with python but seems simple enough.

@eedorenko
Copy link
Collaborator

Fixed in #39

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

2 participants