Skip to content

Commit

Permalink
output log from popen
Browse files Browse the repository at this point in the history
  • Loading branch information
yanksyoon committed May 22, 2024
1 parent 7eb82e8 commit 9f0d6d6
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

# Ignore B404:blacklist since all subprocesses are run with predefined executables.
import subprocess # nosec
import sys
from dataclasses import dataclass
from pathlib import Path

Expand Down Expand Up @@ -46,10 +45,9 @@
GITHUB_RUNNER_IMAGE_BUILDER = UBUNTU_HOME / ".local/bin/github-runner-image-builder"
OPENSTACK_CLOUDS_YAML_PATH = UBUNTU_HOME / "clouds.yaml"
OPENSTACK_IMAGE_ID_ENV = "OPENSTACK_IMAGE_ID"
OUTPUT_LOG_PATH = UBUNTU_HOME / "github-runner-image-builder.log"
IMAGE_NAME_TMPL = "{IMAGE_BASE}-{APP_NAME}-{ARCH}"

OUTPUT_LOG_PATH = Path("/var/log/github-runner-image-builder.log")


@dataclass
class CallbackConfig:
Expand Down Expand Up @@ -288,14 +286,13 @@ def build_immediate(config: CronConfig) -> None:
f"--cloud-name {config.cloud_name} "
f"--num-revisions {config.num_revisions} "
f"--callback-script-path {CALLBACK_SCRIPT_PATH} "
f"--output-image-name {output_image_name}"
f"--output-image-name {output_image_name} "
f">> {OUTPUT_LOG_PATH} 2>&1\n"
),
env={"HOME": str(UBUNTU_HOME)},
shell=True,
cwd=UBUNTU_HOME,
user=UBUNTU_USER,
stdout=sys.stdout,
stderr=sys.stderr,
)
logger.info("Build process started with pid: %s", proc.pid)

Expand Down

0 comments on commit 9f0d6d6

Please sign in to comment.