-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[confcom] Restore the behaviour of --upload-fragment for acifragmentgen
#9223
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
Closed
Closed
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
18665a3
Remove the depedency on OPA
DomAyre 74955ad
Bump version
DomAyre 9b1a24f
Organise imports
DomAyre 59162fe
Merge branch 'main' into remove-opa
DomAyre 629c529
Restore default behaviour of --upload-fragment and give new args for …
DomAyre e5f138d
Add testing to enforce behaviour
DomAyre 093cbd5
Test possible fixes for ado pipeline failure
DomAyre 77e2461
Avoid using localhost for docker operations
DomAyre 078fea2
Remove arg for TemporaryDirectory which is only in newer python version
DomAyre 27f0ef4
Replace docker python SDK with CLI
DomAyre fa87416
Bump the version of confcom
DomAyre 1093eed
Split fragment push and fragment attach into standalone tools
DomAyre c3cce05
Undo changes
DomAyre 3e661d6
Print some debug info
DomAyre 5c5a8bf
Add missing licenses
DomAyre 4aef917
Handle case with attached fragments
DomAyre d23c671
Add fallback debug info
DomAyre d3c978f
Fix check
DomAyre 6ff6395
Fix typo
DomAyre f82a9a4
Fix another typo
DomAyre f825e6f
Satisfy azdev linter
DomAyre 5c0f27e
Fix azdev style
DomAyre 3c90719
Fix missing import
DomAyre 3a510cb
Fix race in tests
DomAyre 62ad4f2
Prevent tests changing tracked files
DomAyre 0de8ab7
Merge branch '16-12-25' into fix-upload-fragment
DomAyre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| import os | ||
| import subprocess | ||
| import tempfile | ||
| from typing import BinaryIO | ||
|
|
||
|
|
||
| def oras_attach( | ||
| signed_fragment: BinaryIO, | ||
| manifest_tag: str, | ||
| ) -> None: | ||
| subprocess.run( | ||
| [ | ||
| "oras", | ||
| "attach", | ||
| "--artifact-type", "application/x-ms-ccepolicy-frag", | ||
| manifest_tag, | ||
| os.path.relpath(signed_fragment.name, start=os.getcwd()), | ||
| ], | ||
| check=True, | ||
| timeout=120, | ||
| ) | ||
|
|
||
|
|
||
| def fragment_attach( | ||
| signed_fragment: BinaryIO, | ||
| manifest_tag: str, | ||
| ) -> None: | ||
|
|
||
| if signed_fragment.name == "<stdin>": | ||
| with tempfile.NamedTemporaryFile(delete=True) as temp_signed_fragment: | ||
| temp_signed_fragment.write(signed_fragment.read()) | ||
| temp_signed_fragment.flush() | ||
| oras_attach( | ||
| signed_fragment=temp_signed_fragment, | ||
| manifest_tag=manifest_tag, | ||
| ) | ||
| else: | ||
| oras_attach( | ||
| signed_fragment=signed_fragment, | ||
| manifest_tag=manifest_tag, | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| import os | ||
| import subprocess | ||
| import tempfile | ||
| from typing import BinaryIO | ||
|
|
||
|
|
||
| def oras_push( | ||
| signed_fragment: BinaryIO, | ||
| manifest_tag: str, | ||
| ) -> None: | ||
| subprocess.run( | ||
| [ | ||
| "oras", | ||
| "push", | ||
| "--artifact-type", "application/x-ms-ccepolicy-frag", | ||
| manifest_tag, | ||
| os.path.relpath(signed_fragment.name, start=os.getcwd()), | ||
| ], | ||
| check=True, | ||
| timeout=120, | ||
| ) | ||
|
|
||
|
|
||
| def fragment_push( | ||
| signed_fragment: BinaryIO, | ||
| manifest_tag: str, | ||
| ) -> None: | ||
|
|
||
| if signed_fragment.name == "<stdin>": | ||
| with tempfile.NamedTemporaryFile(delete=True) as temp_signed_fragment: | ||
| temp_signed_fragment.write(signed_fragment.read()) | ||
| temp_signed_fragment.flush() | ||
| oras_push( | ||
| signed_fragment=temp_signed_fragment, | ||
| manifest_tag=manifest_tag, | ||
| ) | ||
| else: | ||
| oras_push( | ||
| signed_fragment=signed_fragment, | ||
| manifest_tag=manifest_tag, | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.