10

I have 3 python packages proj1, proj12 and proj13. Both proj12 and proj13 depend on proj1 (with from proj1.xxx import yyy).

The 3 projects are on a private gitlab instance, each one has it's own .gitlab-ci.

In proj1 http://gitlab.me.com/group/proj1/.gitlab-ci.yml we run unittest and create a wheel exposed as an artifact::

# http://gitlab.me.com/group/proj1/.gitlab-ci.yml
image: python:2
mytest:
  artifacts:
    paths:
    - dist
  script:
  - apt-get update -qy; apt-get install -y python-dev python-pip
  - pip install -r requirements.txt
  - python setup.py test
  - python setup.py bdist_wheel
look:
  stage: deploy
  script:
  - ls -lah dist

For proj12 and proj13 in e.g. http://gitlab.me.com/group/proj12/.gitlab-ci.yml we would like to run tests too, but I need to install proj1 wheel to make it run.

All 3 projects are in the same gitlab private group.

What is the gitlab way to do this ?

  • to pass the proj1 wheel to the proj12 with an artifact
    • in this case I don't know how to call/get the artifact in http://gitlab.me.com/group/proj12/.gitlab-ci.yml ? It's the same gitlab, the same group, but a different project.
  • Use a gitlab Secret Variable to store ssh_keys to clone proj2 in proj12/.gitlab-ci.yml ?
    • related to https://gitlab.com/gitlab-org/gitlab-ce/issues/4194
    • this does not take benefit of the fact that proj1, proj12 and proj13 are in the same gitlab and same group, the person who do the build for one project as credentials to do the others. All 3 are connected by the user private token.

I try to avoid to have to deploy devpi or pypiserver like solutions.

So I'm looking on what to write in the proj12 .gitlab-ci.yml to get the dist/proj1-0.42-py2-none-any.whl wheel from the proj1 precedent build::

# http://gitlab.me.com/group/proj12/.gitlab-ci.yml
image: python:2
mytest12:
  script:
  - apt-get update -qy; apt-get install -y python-dev python-pip
  - pip install -r requirements.txt
  - pip install .
  - => some way here to get the proj1 wheel 
  - pip install proj1-0.42-py2-none-any.whl
  - python setup.py test

Links related to our issue:

user3313834
  • 7,327
  • 12
  • 56
  • 99

1 Answers1

1

You have two ways you can do it:

I would advise passing as an artifact since then you will have it build exactly in the pipeline you are running. As for the cloning, AFAIK you don't need any workaround when cloning submodules but for cloning other repositories I would go with ssh deploy key as it's connected with a repo and not a user like the private token.

Jakub Kania
  • 15,665
  • 2
  • 37
  • 47
  • I've impacted my question with your comments, I doesn't know that we can use an artifact created in the build of one project in the `.gitlab-ci.yml` of some other gitlab project. – user3313834 Jan 08 '17 at 20:13
  • @user3313834 You supply the artifact as a path, it's avaiable in the same path in your next build. You path is dist so just do `ls dist` as the first step in your next build and you will see it. – Jakub Kania Jan 08 '17 at 22:41
  • Yes I've read really carefully the artifact gitlab documentation, artifact are in the path **of the same container** accessible only by a job of the **same** gitlab-ci.yml in the same project. We need the artifact created in proj1 accessible in the proj12, a different gitlab project, a different git repository. I probably miss something but the documentation you point share artifact with a job of the same project. – user3313834 Jan 08 '17 at 23:28
  • @user3313834 Aaaah, I missed the part about the same project. Correct. Though that reminds me I forgot about custom docker containers. – Jakub Kania Jan 09 '17 at 08:35