Deploy can't use output from Build?

I’m trying to setup Gitlab-CI so that it first builds a project and then tests/deploys it.

But I can’t figure out how to tell it to keep the build output, at the deploy step it always removes the build output first:

Fetching changes...
Removing .gradle/
Removing build/
Checking out 3b557737 as master...

This is my .gitlab-ci.yml:

  image: private/jbuild:latest
  type: build
    gradle all

  image: private/ddist:latest
  type: deploy
    ls -l

How can I tell it to keep build so I can use it for deployment?

Similar problem here, the image (which I can verify was updated by running docker images) produced during my build step is ignored in the test step.

  - build
  - test

# Update the Docker container used for running tests. This is important to
# prevent unecessary failures when for example salt/my-project.sls is changed.
  type: build
    - shell
    - cd salt; docker build -t my-project .

# Do tests.
  type: test
    - docker
    - ./

I’d still need help with this … any ideas?


I got in touch with the Gitlab support team. Here is [the relevant part of] the response:

I heard from our team. Currently it is not possible to pass artifacts between builds, but it is on the pipeline, so this feature will be added in the future. it is, however, possible to move the generated docker image outside of the temporary folder where they are generated. This should allow you to reuse them.

If git clone is used it will force docker build to rebuild all images, in most cases.

Also, please make sure that you are able to run the following command on your docker container:

docker run myproject rbenv

If it’s not working, the environment PATH should be fixed to make the above command to run. This may happen because builds that are run in docker containers are run in non-login mode. Which is different from the usually used docker interactive mode docker run -it myproject

@cmtonkinson It’s strange because the types seem to imply that this should work but thank you for the information.

Agree 100%. It’s good to know it’s on the roadmap, though they weren’t exactly forthcoming with a timeline, but it should become clear before long: Almost Everything We Do Will Be Open

PS: Filed a proper ticket: