Skip to content

Repoman - Adding support for Rewrite Rules in repo yaml. - #538

Merged
hattan merged 4 commits into
Azure:mainfrom
kaizentm:cse/add-rewrite-rules
Sep 1, 2022
Merged

Repoman - Adding support for Rewrite Rules in repo yaml.#538
hattan merged 4 commits into
Azure:mainfrom
kaizentm:cse/add-rewrite-rules

Conversation

@hattan

@hattan hattan commented Aug 29, 2022

Copy link
Copy Markdown
Contributor

This PR addresses #524 and provides an update to the repoman.yaml file structure to introduce a new property for Rewrite rules. The rules property replaces the previously used patterns list.

Changes:

  • Introduce new rewrite.rules section.
  • Add Rewrite rules section to all repo.yaml files for all existing templates.
 rewrite:
    rules:
      - from: ../../../../common/infra/bicep
        to: ./
        patterns:
          - "**/*.bicep"

Similar to AssertRules, Rewrite rules supports the following options per rule:

  • from: the path string to replace.
  • to: the replacement string.
  • patterns: A list of glob patterns to apply the replacement to.
  • ignore: pattern of files to ignore in the glob search.

Testing:

  • Generated all templates locally and verified that azure.yaml and IAC paths were rewritten correctly.
  • Deployed a generated fork repo via azd up to ensure templates are still functioning.
  • Tested CI Generation of all templates on fork.

Co-authored-by: Hadwa Gaber <hadwaa@microsoft.com>
@hattan
hattan requested a review from HadwaAbdelhalem August 29, 2022 15:01
@hattan hattan changed the title Repoman - Adding support for ReWrite Rules in repo yaml. Repoman - Adding support for Rewrite Rules in repo yaml. Aug 29, 2022
@jongio

jongio commented Aug 29, 2022

Copy link
Copy Markdown
Member

Can you also run test-templates.sh found in templates/todo/tests?

@hattan

hattan commented Aug 29, 2022

Copy link
Copy Markdown
Contributor Author

Can you also run test-templates.sh found in templates/todo/tests?

No problem. I will run the test script.

@wbreza wbreza left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looking good - added a few comments for you to take a look at.

Comment thread templates/todo/projects/python-mongo-aca/repo.yaml Outdated
Comment thread generators/repo/src/commands/generate.ts Outdated
hattan and others added 2 commits August 30, 2022 14:32
Co-authored-by: Hadwa Gaber <hadwaa@microsoft.com>
…sults in all files being inspected.

Co-authored-by: Hadwa Gaber <hadwaa@microsoft.com>
@hattan
hattan marked this pull request as ready for review August 31, 2022 20:59
@hattan

hattan commented Aug 31, 2022

Copy link
Copy Markdown
Contributor Author

Can you also run test-templates.sh found in templates/todo/tests?

I ran the test script against python-mongo and csharp-sql on the fork and both passed. Seeing the results of the CI run, there is no diff between the generated repos and staging indicating that the change is transparent to the target template repos.

@wbreza wbreza left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for adding this support - looking great :)

@azure-sdk

Copy link
Copy Markdown
Collaborator

Repoman Generation Results

Repoman pushed changes to remotes for the following projects:
No changes detected.

@hattan
hattan merged commit d9a7e98 into Azure:main Sep 1, 2022
vhvb1989 added a commit that referenced this pull request Jul 24, 2026
…9240)

* chore(deps): group Dependabot security updates into one PR

Addresses all open Dependabot alerts across the repo:

- cli/azd/extensions/azure.ai.rle: bump golang.org/x/crypto 0.49.0 -> 0.52.0
  and golang.org/x/net 0.52.0 -> 0.55.0 (alerts #456-#469). Note x/net
  requires 0.55.0 for full remediation of #456.
- ext/vscode: js-yaml -> 4.3.0, brace-expansion -> 2.1.2 & 5.0.7
  (alerts #539, #540, #541)
- ext/azuredevops/setupAzd: adm-zip -> 0.6.0, azure-pipelines-task-lib -> 5.278.0,
  brace-expansion -> 1.1.16 & 2.1.2 (alerts #535, #537, #538)
- cli/azd/test/eval: brace-expansion -> 1.1.16 (alert #536)

Supersedes and consolidates #9093 and #9215.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2cef6dea-2ec8-4538-8e55-7a2b0dfa196c

* ci: make azdo-extension npm steps non-blocking on PR builds

The azdo-extension pipeline currently fails on the self-hosted Linux and
Windows agents because they cannot reach registry.npmjs.org (npm EPERM
egress block); `npm i -g npm` fails before any dependency is resolved.
Build Mac (hosted pool) and the vscode build (same self-hosted pool) are
unaffected, confirming this is an agent egress issue, not a code problem.

Make the npm-dependent steps (install, test, package) non-blocking for PR
validation builds only (Build.Reason == PullRequest) so this gate does not
block unrelated PRs such as the grouped Dependabot security update. Release
and CD builds on main remain strict, so CodeQL and artifact generation are
unaffected. Artifact staging is skipped on PR builds since the package step
may not produce a VSIX while the egress issue persists.

Tracking issue to fix the egress block and re-enable the gate: #9286

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2cef6dea-2ec8-4538-8e55-7a2b0dfa196c

* ci: trigger azdo pipeline PR validation on build template changes

Add the azuredevops build/stage templates to the release-azuredevops
pipeline PR and CI path filters so edits to the build job template are
validated by the azdo-extension pipeline (previously only changes under
ext/azuredevops or the root pipeline file triggered it).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2cef6dea-2ec8-4538-8e55-7a2b0dfa196c

* ci: skip azdo-extension Sign stage on PR builds

Now that the BuildAndTest stage completes with issues (instead of hard
failing) on PR validation builds while the self-hosted agent npm egress
issue persists (#9286), the Sign stage began running on PRs and failed
because no vsix artifact is produced on PR builds. Signing is never
performed for PR builds, so gate the whole Sign stage to release/CI/manual
build reasons. Also add the sign/publish stage templates to the pipeline
PR path filters so template changes are validated.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2cef6dea-2ec8-4538-8e55-7a2b0dfa196c

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2cef6dea-2ec8-4538-8e55-7a2b0dfa196c
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.

4 participants