-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
apps: Fetch app images if sbom is turned off
Signed-off-by: Mike Sul <mike.sul@foundries.io>
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import argparse | ||
import logging | ||
import os | ||
import subprocess | ||
|
||
from apps.compose_apps import ComposeApps | ||
from apps.apps_publisher import AppsPublisher | ||
from helpers import status | ||
|
||
|
||
def main(args): | ||
status("Fetching app images to the local docker engine store") | ||
|
||
publisher = AppsPublisher(args.factory, "", "") | ||
apps = ComposeApps(args.apps_root, quiet=True) | ||
publisher.tag(apps, args.tag) | ||
for app in apps: | ||
subprocess.check_call(["docker", "compose", "--project-directory", app.dir, "pull"]) | ||
|
||
|
||
def get_args(): | ||
factory = os.environ.get("FACTORY") | ||
arch = os.environ.get("ARCH") | ||
parser = argparse.ArgumentParser("Pull app images into a local docker store") | ||
parser.add_argument("--factory", default=factory) | ||
parser.add_argument("--apps-root", default="./") | ||
parser.add_argument("--tag", required=True) | ||
parser.add_argument("--arch", default=arch) | ||
args = parser.parse_args() | ||
return args | ||
|
||
|
||
if __name__ == "__main__": | ||
logging.basicConfig(format='%(asctime)s %(levelname)s: %(module)s: %(message)s', level=logging.INFO) | ||
args = get_args() | ||
|
||
# FACTORY must be set so that expandvars above will work correctly for | ||
# service images like: hub.foundries.io/${FACTORY}/foo | ||
os.environ["FACTORY"] = args.factory | ||
main(args) | ||
|