Skip to content

librarian: generate error when remove_regex in state.yaml is empty #1739

@quartzmo

Description

@quartzmo

Expected

Given the state.yaml below with empty remove_regex, librarian should behave as described in this comment from the listing in the Onboarding doc. Also note typo "preceidece" and legacy field souce_paths in the comment.

    # If configured, these files/dirs will be removed before generated code is copied 
    # over. A more specific `preserve_regex` takes preceidece. If not not set, defaults
    # to the `souce_paths`.
    remove_regex:
image: image=gcr.io/cloud-go-infra/librariangen:latest
libraries:
    - id: secretmanager
      version: 1.15.0
      last_generated_commit: 8fe8f9f460fe5dd1df95057659d2520ceca3c9c6
      apis:
        - path: google/cloud/secretmanager/v1
          service_config: secretmanager_v1.yaml
        - path: google/cloud/secretmanager/v1beta2
          service_config: secretmanager_v1beta2.yaml
      source_roots:
        - secretmanager
        - internal/generated/snippets/secretmanager
      preserve_regex:
        - secretmanager/CHANGES.md
        - secretmanager/aliasshim/aliasshim.go
        - secretmanager/apiv1/iam.go
        - secretmanager/apiv1/iam_example_test.go
      remove_regex:

Actual

2025/08/14 18:32:58 INFO librarian arguments="[generate --image=gcr.io/cloud-devrel-public-resources/librarian-go:infrastructure-public-image-latest --repo=/usr/local/google/home/chrisdsmith/oss/google-cloud-go-2 --library=secretmanager --api=google/cloud/secretmanager/v1,google/cloud/secretmanager/v1beta2 --api-source=/usr/local/google/home/chrisdsmith/oss/googleapis]"
2025/08/14 18:32:58 INFO Temporary working directory dir=/tmp/librarian-20250814T183258Z
2025/08/14 18:32:58 INFO Opening repository dir=/usr/local/google/home/chrisdsmith/oss/googleapis
2025/08/14 18:33:00 INFO Opening repository dir=/usr/local/google/home/chrisdsmith/oss/google-cloud-go-2
2025/08/14 18:33:06 INFO Code will be generated dir=/tmp/librarian-20250814T183258Z/output
2025/08/14 18:33:06 INFO Performing generation for library id=secretmanager
2025/08/14 18:33:06 INFO === Docker start ===============================================================
2025/08/14 18:33:06 INFO /usr/bin/docker run --rm -v /usr/local/google/home/chrisdsmith/oss/google-cloud-go-2/.librarian:/librarian -v /usr/local/google/home/chrisdsmith/oss/google-cloud-go-2/.librarian/generator-input:/input -v /tmp/librarian-20250814T183258Z/output:/output -v /usr/local/google/home/chrisdsmith/oss/googleapis:/source:ro --user 975507:89939 gcr.io/cloud-devrel-public-resources/librarian-go:infrastructure-public-image-latest generate --librarian=/librarian --input=/input --output=/output --source=/source
2025/08/14 18:33:06 INFO --------------------------------------------------------------------------------
time=2025-08-14T18:33:07.326Z level=INFO msg="librariangen: invoked" args="[/usr/local/bin/librariangen generate --librarian=/librarian --input=/input --output=/output --source=/source]"
time=2025-08-14T18:33:07.327Z level=INFO msg="processing api" service_dir=/source/google/cloud/secretmanager/v1
time=2025-08-14T18:33:07.655Z level=INFO msg="processing api" service_dir=/source/google/cloud/secretmanager/v1beta2
time=2025-08-14T18:33:17.047Z level=INFO msg="librariangen: finished successfully"
2025/08/14 18:33:19 INFO === Docker end =================================================================
2025/08/14 18:33:19 INFO Clean destinations and copy generated results for library id=secretmanager
2025/08/14 18:33:19 open /usr/local/google/home/chrisdsmith/oss/google-cloud-go-2/internal/generated/snippets/secretmanager/apiv1/Client/AccessSecretVersion/main.go: file exists

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions