#!/bin/sh
# SPDX-License-Identifier: MulanPSL-2.0+
# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.

. ../defconfig.sh

load_cci_defaults

# the CODE_SIGN_DOMAIN_NAME and CODE_SIGN_SERVER_ADDRESS were used for code sign.
# ignore them or assign random sting if no need for code sign
# the keys were set in file:
#
#	/etc/compass-ci/info-file
load_cci_secrets \
	CODE_SIGN_DOMAIN_NAME \
	CODE_SIGN_SERVER_ADDRESS

# the domain name and server address should not writen in plain test.
# do the replacement for them before building the image
sed -i \
    -e "s/CODE_SIGN_DOMAIN_NAME/${CODE_SIGN_DOMAIN_NAME}/" \
    -e "s/CODE_SIGN_SERVER_ADDRESS/${CODE_SIGN_SERVER_ADDRESS}/" \
    client.toml

docker_skip_rebuild "publisher:latest"

download_repo "cbs" "$git_branch_cbs"

docker build --no-cache -t publisher:latest --build-arg ARCH=$(arch) .

push_image_remote "publisher"
