-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: add pkg support in orasclient (#7)
- Loading branch information
1 parent
f887ab5
commit 87c8e5e
Showing
5 changed files
with
55 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 |
---|---|---|
@@ -1,19 +1,61 @@ | ||
import oras.client | ||
import os | ||
import argparse | ||
|
||
client = oras.client.OrasClient() | ||
|
||
token = os.getenv("GITHUB_TOKEN", "") | ||
username = os.getenv("GITHUB_USERNAME", "") | ||
|
||
|
||
client.login(password=token, username=username) | ||
|
||
client.push( | ||
target="ghcr.io/appthreat/blintdb-meson:v0.1", | ||
config_path="./.oras/config.json", | ||
annotation_file="./.oras/annotations.json", | ||
files=[ | ||
"./blint.db:application/vnd.appthreat.blintdb.layer.v1+tar", | ||
], | ||
) | ||
parser = argparse.ArgumentParser( | ||
prog="orasclient_blintdb", description="Helps pushing blint.db into a container and uploading to ghcr.io" | ||
) | ||
parser.add_argument( | ||
"-p", | ||
"--pkg-manager", | ||
dest="pkg", | ||
help="Path to the CDXGEN bom file (NOT IMPLEMENTED)", | ||
) | ||
args = vars(parser.parse_args()) | ||
|
||
if pkg := args.get("pkg", None): | ||
# not using fstring here to make sure value is correct | ||
# otherwise wrong file may be uploaded | ||
if pkg=="vcpkg": | ||
client.push( | ||
target="ghcr.io/appthreat/blintdb-vcpkg:v0.1", | ||
config_path="./.oras/config.json", | ||
annotation_file="./.oras/annotations.json", | ||
files=[ | ||
"./blint.db:application/vnd.appthreat.blintdb.layer.v1+tar", | ||
], | ||
) | ||
if pkg=="meson": | ||
client.push( | ||
target="ghcr.io/appthreat/blintdb-meson:v0.1", | ||
config_path="./.oras/config.json", | ||
annotation_file="./.oras/annotations.json", | ||
files=[ | ||
"./blint.db:application/vnd.appthreat.blintdb.layer.v1+tar", | ||
], | ||
) | ||
if pkg=="vcpkg-tst": | ||
client.push( | ||
target="ghcr.io/appthreat/blintdb-vcpkg-tst:v0.1", | ||
config_path="./.oras/config.json", | ||
annotation_file="./.oras/annotations.json", | ||
files=[ | ||
"./blint.db:application/vnd.appthreat.blintdb.layer.v1+tar", | ||
], | ||
) | ||
if pkg=="meson-tst": | ||
client.push( | ||
target="ghcr.io/appthreat/blintdb-meson-tst:v0.1", | ||
config_path="./.oras/config.json", | ||
annotation_file="./.oras/annotations.json", | ||
files=[ | ||
"./blint.db:application/vnd.appthreat.blintdb.layer.v1+tar", | ||
], | ||
) |