-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[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
Open
DomAyre
wants to merge
22
commits into
Azure:main
Choose a base branch
from
DomAyre:fix-upload-fragment
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
6abbce1
Restore default behaviour of --upload-fragment and give new args for …
DomAyre 7e956d6
Add testing to enforce behaviour
DomAyre 2bcdc2f
Test possible fixes for ado pipeline failure
DomAyre 7705c49
Avoid using localhost for docker operations
DomAyre 1bc04fa
Remove arg for TemporaryDirectory which is only in newer python version
DomAyre 5c3a4e8
Replace docker python SDK with CLI
DomAyre ccc4478
Bump the version of confcom
DomAyre f1c710e
Split fragment push and fragment attach into standalone tools
DomAyre b675b43
Undo changes
DomAyre 472c6cf
Print some debug info
DomAyre 60f33fa
Add missing licenses
DomAyre 312b74a
Handle case with attached fragments
DomAyre 233391a
Add fallback debug info
DomAyre d608b70
Fix check
DomAyre b939721
Fix typo
DomAyre 1adcde5
Fix another typo
DomAyre 6d3c86f
Satisfy azdev linter
DomAyre b6e057b
Fix azdev style
DomAyre 4d0227c
Merge branch 'main' into fix-upload-fragment
DomAyre 23cae3e
Merge remote-tracking branch 'origin' into fix-upload-fragment
DomAyre f8e65d7
Merge branch 'main' into fix-upload-fragment
DomAyre 1be12cd
Merge branch 'main' 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.