Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
1.7 kB
2
Indexable
Never
import subprocess

def change_nuget_config_v2(module_path, module_name, is_dev):
    extra_param_arm = extra_param
    if to_cache:
        cache_options = f"--cache-from type=registry,ref={env.ECR_URL}/carwale-build-cache:{module_name}-develop-arm "
        extra_param_arm += cache_options
        if branch_name == "develop":
            cache_options = f"--cache-to image-manifest=true,oci-mediatypes=true,mode=max,compression=zstd,compression-level=1,force-compression=true,type=registry,ref={env.ECR_URL}/carwale-build-cache:{module_name}-{branch_name}-arm "
            extra_param_arm += cache_options
        elif is_dev and multi_lang_build and job_conf.repo_folder == "carwaleweb" and "npmTestDir" in job_conf:
            app_dir = f"{module_path}/{app_folder_name}"
            enable_multi_lang_settings(app_dir, job_conf.module_build_configuration, job_conf["npmTestDir"])
    print(extra_param_arm)
    arm_script = f"""#!/bin/bash
set -e
aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin 726616043643.dkr.ecr.ap-south-1.amazonaws.com
docker buildx build --push -t {env.ECR_URL}/{module_name}:{module_tag_ARM} --progress=plain --build-arg Configuration={job_conf.module_build_configuration} --build-arg S3BucketKey={job_conf.s3_static_bucket} --build-arg BranchName={branch_name} --build-arg GitToken={GITHUB_CI_TOKEN} --build-arg ServiceName={job_conf.main_service_folder} {extra_param_arm} -f {docker_file} .
"""
    arm_output = subprocess.run(arm_script, shell=True, capture_output=True, text=True)
    if arm_output.returncode != 0:
        raise Exception("arm docker image creation failed")
Leave a Comment