CI environment variables for project and namespace name
CI jobs have access to several environment variables including information about the current project. These include:
CI_PROJECT_NAME- The project name that is currently being built
CI_PROJECT_NAMESPACE- The project namespace (username or groupname) that is currently being built
CI_PROJECT_PATH- The namespace with project name
$CI_PROJECT_PATHlowercased and with everything except 0-9 and a-z replaced with -. Use in URLs and domain names.
CI_PROJECT_URL- The HTTP address to access project
CI_PROJECT_NAMESPACE are misleading - they provide the paths and not the names of the project and namespace. It is not currently possible to obtain these names from any environment variable.
I propose that the project name and namespace name be made available as CI environment variables.
Over in issue gitlab-ce#32513 it was determined that the behavior of
CI_PROJECT_NAME is incorrect and that the name should be used instead of the path. I agree with this suggestion.
For the namespace, I would propose either:
CI_PROJECT_NAMESPACEto contain the name instead of the path; or,
CI_PROJECT_NAMESPACEas-is and creating
CI_PROJECT_NAMESPACE_NAMEto contain the name
Links / references
- Issue gitlab-ce#32513
This feature will provide CI jobs with the
name of the project and its namespace. These are currently unavailable to those jobs.
One example use case would be notifying developers about builds passing or failing. For example, when GitLab CI deploys changes to a server, we have a custom script that sends a push notification to Slack:
Instead of using the path of
sae/sae-itc-drupal7, I'd like to be able to use the human-friendly namespace and project names which I don't currently have access to during the job which issues this push notification.
Make sure these are completed before closing the issue, with a link to the relevant commit.