ci: fix how to build a static go binary

parent 6ad1a5e8
......@@ -32,7 +32,7 @@ pre_build:checker:
- docker push $CI_REGISTRY_IMAGE/checks:ci-${CI_PIPELINE_ID}
- docker push $CI_REGISTRY_IMAGE/checks:latest
pre_build:tar-spliut:
pre_build:tar-split:
stage: pre_build
tags:
- docker
......@@ -42,7 +42,7 @@ pre_build:tar-spliut:
- apk add go=1.11.5-r0
- apk add musl-dev
- go get -d github.com/vbatts/tar-split/cmd/tar-split
- CGO_ENABLED=0 go build -o $HOME/tar-split $HOME/go/src/github.com/vbatts/tar-split/cmd/tar-split
- go build -o $HOME/tar-split -a -ldflags '-extldflags "-static"' $HOME/go/src/github.com/vbatts/tar-split/cmd/tar-split
package:docs:
stage: prepare
......
......@@ -65,7 +65,8 @@ class DockerPackaging(BasePackagePlugin): # pylint: disable=too-many-instance-a
self.aiodocker = Docker()
self.util = DockerUtil(cache_dir=self.config["cache_dir"],
storage=self.config["storage"], aiodocker=self.aiodocker,
logger=self.log, local_node=self.node)
logger=self.log, local_node=self.node,
tar_split_path=self.config['tar_split_path'])
self.docker = docker.from_env()
self.docker_lc = docker.APIClient()
self.probe_task = None
......
......@@ -124,7 +124,7 @@ class DockerUtil: # pylint: disable=too-many-instance-attributes
def __init__(self, cache_dir: str, storage: str, # pylint: disable=too-many-arguments
aiodocker: Docker = None, logger: logging.Logger = None,
local_node: Node = None) -> None:
local_node: Node = None, tar_split_path=None) -> None:
self.cache_dir = cache_dir
self.layer_tar_path = self.cache_dir + '/layers/tar/sha256' # for storing archives of layers
self.layer_gz_path = self.cache_dir + '/layers/gz/sha256' # for storing compressed archives
......@@ -148,6 +148,7 @@ class DockerUtil: # pylint: disable=too-many-instance-attributes
self.logger = logger if logger else LOGGER
self.queues: dict = {}
self.emitters: dict = {}
self.tar_split_path = tar_split_path
@property
def digest_path(self)-> str:
......@@ -1175,8 +1176,8 @@ class DockerUtil: # pylint: disable=too-many-instance-attributes
output_file = os.path.join(self.layer_tar_path, del_idpref(diff_id) + '.tar')
cmd = self.config['tar_split_path'] + " asm --input " + input_file + " --path " + relative_path + \
" --output " + output_file
cmd = self.tar_split_path + " asm --input " + input_file + " --path " + \
relative_path + " --output " + output_file
with open('/dev/null', 'w') as devnull:
subprocess.run(cmd.split(), env=os.environ, stdout=devnull, stderr=devnull)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment