CI_BUILD_TOKEN vs CI_JOB_TOKEN

CI_BUILD_TOKEN variable was renamed to CI_JOB_TOKEN a while ago so make sure to use this when authenticating against repos.

Job Artifacts

see reference here

 
jobname:
	stage: build
	image: someimage
	script: ./build
	artifacts:
		paths:
			- output_of_script.file
		expire_in: 1 week # optional
		

Artifact Dependencies

If you declare dependencies between a job and a previous step, you can have it download the artifacts generated by upstream jobs:

job_two:
	stage: after_build
	dependencies:
		- jobname
	script: cat output_of_script.file

Installing python packages

If you are getting errors like this:

pip install testname --index-url https://__token__:<token>@gitlab.example.com/api/v4/projects/<project-id>/packages/pypi/simple
 
Looking in indexes: https://__token__:****gitlab.example.com/api/v4/projects/<project-id>/packages/pypi/simple
ERROR: Could not find a version that satisfies the requirement testname (from versions: none)
ERROR: No matching distribution found for riot

Check your API key. You may not have permission. Running this command with -vv can force pip to display issues such as a 403 response which indicates that your key is valid but doesn’t have the right permissions.