Skip to content

chore: GitHub Actions workflow to generate new client library#10179

Merged
diegomarquezp merged 52 commits into
googleapis:mainfrom
diegomarquezp:main
Jan 17, 2024
Merged

chore: GitHub Actions workflow to generate new client library#10179
diegomarquezp merged 52 commits into
googleapis:mainfrom
diegomarquezp:main

Conversation

@diegomarquezp
Copy link
Copy Markdown
Contributor

@diegomarquezp diegomarquezp commented Dec 21, 2023

Using a forked repo to confirm the workflow works correctly before merging this

Example for java-meet: diegomarquezp#11

@suztomo
Copy link
Copy Markdown
Member

suztomo commented Jan 4, 2024

I expect this pull request comes earlier than "Start to migrate new-client.py to sdk-platform-java". Once new-client.py moves to sdk-platform-java, we'll add "git clone" command in one of the steps to get.

Comment thread .github/workflows/generate_new_client.yaml Outdated
Comment thread .github/workflows/generate_new_client.yaml Outdated
Copy link
Copy Markdown
Member

@suztomo suztomo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When creating a pull request, can you try to use the identify of the person who run the job?

If that works, then there's no need to set up authentication token in the repository or your forked personal repository to test.

@suztomo
Copy link
Copy Markdown
Member

suztomo commented Jan 13, 2024

When creating a pull request, can you try to use the identify of the person who run the job?

I should write that this might not work.

@suztomo
Copy link
Copy Markdown
Member

suztomo commented Jan 13, 2024

I tried github workflow dispatch to use GITHUB_TOKEN (https://github.com/suztomo/troubleshoot-bazel-repo-rule/blob/main/.github/workflows/create-pull-request.yaml) but it never becomes the token of the person who invokes the workflow. It seems my memory was incorrect.

Let's use YOSHI_CODE_BOT_TOKEN. For your forked repository set the secret to your personal access token.

Comment thread .github/workflows/generate_new_client.yaml Outdated
Comment thread .github/workflows/generate_new_client.yaml Outdated
@suztomo
Copy link
Copy Markdown
Member

suztomo commented Jan 13, 2024

Once it creates a pull request in your forked repository (Java-shopping-css is a good example.),

  • add the URL of the generated pull request in the description of this pull request. I want to see the input parameters values are there.
  • Run diff with the merged pull request for java-shopping-css.

Comment thread generation/new_client/README.md Outdated
> - [`distribution_name`](https://github.com/googleapis/google-cloud-java/blob/main/generation/new_client/README.md#advanced-options)


## Prerequisites (for local environment)
Copy link
Copy Markdown
Member

@suztomo suztomo Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you bring environment setup to the bottom? It's now not that important.

Copy link
Copy Markdown
Member

@suztomo suztomo Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Ensure no Release Please "snapshot" pull request open', which is not environment setup, is still valid.

Comment thread generation/new_client/README.md Outdated
Install Docker.
## Run via github action

You can save the time to setup the environment by calling the
Copy link
Copy Markdown
Member

@suztomo suztomo Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can save the time to setup the environment by calling the

This reads as if this is a good option for the reader. Would you rewrite this is the way for the reader to follow?

In other words, don't give the reader a task of determining whether they should use GitHub Actions or new-client.py script.

Comment thread generation/new_client/README.md Outdated
Comment on lines +61 to +62

You will run new-client.py script with the following parameters.
You will run new-client.py script or [github action](https://github.com/googleapis/google-cloud-java/actions/workflows/generate_new_client.yaml) with the following parameters.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't create a task of determining whether to use new-client.py or GitHub Actions.

Comment thread generation/new_client/README.md
@diegomarquezp
Copy link
Copy Markdown
Contributor Author

diegomarquezp commented Jan 17, 2024

Looks like github.token and YOSHI_APPROVER_PRIVATE_TOKEN are not working

https://github.com/googleapis/google-cloud-java/actions/runs/7560449025/job/20586498055?pr=10179

Cloning googleapis-gen...
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/click/core.py", line 11[30](https://github.com/googleapis/google-cloud-java/actions/runs/7560449025/job/20586498055?pr=10179#step:11:31), in __call__
    return self.main(*args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/runner/work/google-cloud-java/google-cloud-java/generation/new_client/new-client.py", line 280, in generate
    subprocess.check_call(["git", "clone", "-q", googleapis_gen_url, "./gen/googleapis-gen"], cwd=workdir)
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/subprocess.py", line [37](https://github.com/googleapis/google-cloud-java/actions/runs/7560449025/job/20586498055?pr=10179#step:11:38)3, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['git', 'clone', '-q', '***github.com/googleapis/googleapis-gen.git', './gen/googleapis-gen']' returned non-zero exit status 128.

https://github.com/googleapis/google-cloud-java/actions/runs/7560449054/job/20586498855?pr=10179

remote: Permission to googleapis/google-cloud-java.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/googleapis/google-cloud-java.git/': The requested URL returned error: 403
Error: Process completed with exit code 12[8](https://github.com/googleapis/google-cloud-java/actions/runs/7560449054/job/20586498855?pr=10179#step:7:9).

@diegomarquezp diegomarquezp enabled auto-merge (squash) January 17, 2024 19:44
@diegomarquezp diegomarquezp added the owlbot:run Add this label to trigger the Owlbot post processor. label Jan 17, 2024
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Jan 17, 2024
@diegomarquezp diegomarquezp merged commit 57b0587 into googleapis:main Jan 17, 2024
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

Successfully merging this pull request may close these issues.

2 participants