Answer the question
In order to leave comments, you need to log in
What is the correct way to declare artifact persistence with Docker volumes?
1. volumes allows you to create only in the assembly directory.
2. The path on the host for the volume is not created automatically, so I create the ${CI_PROJECT_DIR} directory and specify it as the path for the artifacts.
3. volume contains path : "path_on_host_in_build_folder : path_in_container : read_write_permissions"
4. build passes. the artifact is being created. In quotation marks, because inside the path of the artifact is empty.
0. of and not of the manuals re-read up and down.
I am getting an error:
Uploading artifacts... found 1 matching files and directories ...
Uploading artifacts as "archive" to coordinator... ok id=632087 responseStatus=201 Created token=roSNWzgE
+ exit 0
Job artifacts
These artifacts are the latest. They will not be deleted (even if expired) until newer artifacts are available.
docker-compose.yml
services:
app:
build:
dockerfile: Dockerfile
context: .
volumes:
- "vlm:/var/www/app:rw"
volumes:
vlm:
external:
name: /var/www/app
.gitlab-ci.yml
upload:
variables:
COMPOSE_FILE: docker-compose.yml
CI_DEBUG_TRACE: "true"
tags:
- docker
stage: upload
script:
- echo $CI_JOB_STAGE
- mkdir -p ${CI_PROJECT_DIR}/tmp/var/www/app
- docker-compose build --force-rm --no-cache
artifacts:
name: "artifact-$CI_JOB_NAME-$CI_COMMIT_REF_NAME"
paths:
- ${CI_PROJECT_DIR}/tmp/var/www/app
expire_in: 1h
when: always
when:
manual
Answer the question
In order to leave comments, you need to log in
Guess 1:
> Uploading artifacts... found 1 matching files and directories
It found one match. Perhaps this is the directory ${CI_PROJECT_DIR}/tmp/var/www/app
in which the file was not found artifact-$CI_JOB_NAME-$CI_COMMIT_REF_NAME
. For a solution, try specifying instead of your option, so. It is not clear how and what kind of file is created in this directory, you do not show this, probably it simply does not fit the template.
artifacts:
when: always
paths:
- "${CI_PROJECT_DIR}/tmp/var/www/app/*" # именно в кавычках
script:
- chmod 777 ${CI_PROJECT_DIR}/tmp/var/www/app
${CI_PROJECT_DIR}/tmp/var/www/app
a directory for a runner is not the same as for a container. Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question