Skip to content

ci: use '-branch' option in Cloud Builds#1914

Merged
suztomo merged 1 commit intogoogleapis:mainfrom
suztomo:infra_branch
Sep 3, 2025
Merged

ci: use '-branch' option in Cloud Builds#1914
suztomo merged 1 commit intogoogleapis:mainfrom
suztomo:infra_branch

Conversation

@suztomo
Copy link
Copy Markdown
Member

@suztomo suztomo commented Sep 3, 2025

The branch option helps us to test the Librarian's generate and
stage-release behavior without touching the main branch of the SDK
repository.

The flag has been added in #1893.
Let's use the flag in the Cloud Builds YAML files.
By default, "main" is passed to the variable (cl/802643045).

I have to wait for the librarian container image update so that the CLI interprets the -push option.

The branch option helps us to test the Librarian's generate and
stage-release behavior without touching the main branch of the SDK
repository.

The flag has been added in googleapis#1893.
Let's use the flag in the Cloud Builds YAML files.
By default, "main" is passed to the variable (cl/802643045).
@suztomo suztomo requested a review from a team as a code owner September 3, 2025 18:47
@suztomo suztomo requested a review from ohmayr September 3, 2025 18:47
@codecov
Copy link
Copy Markdown

codecov bot commented Sep 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.91%. Comparing base (af7b19e) to head (1525fb1).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1914      +/-   ##
==========================================
+ Coverage   81.78%   81.91%   +0.13%     
==========================================
  Files          83       83              
  Lines        8735     8788      +53     
==========================================
+ Hits         7144     7199      +55     
+ Misses       1238     1236       -2     
  Partials      353      353              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@suztomo suztomo closed this Sep 3, 2025
@suztomo suztomo reopened this Sep 3, 2025
@suztomo
Copy link
Copy Markdown
Member Author

suztomo commented Sep 3, 2025

Now the container image is updated. It has "-branch" flag.

suztomo@suztomo:~/librarian$ docker run us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/librarian:latest generate -h
Specify the API repository root and the path within it for the API to generate.
Optional flags can be specified to use a non-default language repository, and to indicate whether or not
to build the generated library.

The generate command handles both onboarding new libraries and regenerating existing ones.
The behavior is determined by the provided flags.

**Onboarding a new library:**
To configure and generate a new library, specify both the "-api" and "-library" flags. This process involves:
1. Running the "configure" command in the language container to set up the repository.
2. Adding the new library's configuration to the ".librarian/state.yaml" file.
3. Proceeding with the generation steps below.

**Regenerating existing libraries:**
If only "-api" or "-library" is specified, the command regenerates that single, existing library.
If neither flag is provided, it regenerates all libraries listed in ".librarian/state.yaml".

The generation process for an existing library involves delegating to the language container's 
'generate' command. After generation, the tool cleans the destination directory and copies the 
new files into place, according to the configuration in '.librarian/state.yaml'. 
If the '--build' flag is specified, the 'build' command is also executed.

**Output:**
After generation, if the "-push" flag is provided, the changes are committed to a new branch, and
a pull request is created. Otherwise, the changes are left in the local working tree for
inspection.

Usage:
  librarian generate -source=<api-root> -api=<api-path> [flags]

Flags:
  -api string
    	path to the API to be configured/generated (e.g., google/cloud/functions/v2)
  -api-source string
    	location of googleapis repository. If undefined, googleapis will be cloned to the output
  -branch string
    	remote branch to use with the code repository for cloning and pull requests. (default "main")
  -build
    	whether to build the generated code
  -host-mount string
    	a mount point from Docker host and within the Docker. The format is {host-dir}:{local-dir}.
  -image string
    	Container image to run for subcommands. Defaults to the image in the pipeline state.
  -library string
    	The ID of a single library to update. This is repo-specific and defined in the state.yaml
  -output string
    	Working directory root. When this is not specified, a working directory will be created in /tmp.
  -push
    	whether to push the generated code
  -repo string
    	Code repository where the generated code will reside.
    	Can be a remote in the format of a remote URL such as 
    	https://github.com/{owner}/{repo} or a local file path like 
    	/path/to/repo. Both absolute and relative paths are supported.
    	If not specified, will try to detect if the current working 
    	directory is configured as a language repository.


2025/09/03 20:35:41 flag: help requested

@suztomo suztomo requested review from chingor13 and ldetmer September 3, 2025 20:31
@suztomo suztomo enabled auto-merge (squash) September 3, 2025 20:40
@suztomo suztomo merged commit 2999753 into googleapis:main Sep 3, 2025
13 of 14 checks passed
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