Artifact Management

Sharing and Versioning

< >

4. Sharing and Versioning

Artifacts facilitate collaboration and version control across teams and projects.

4.1 Publishing Artifacts

Publish artifacts securely for consumption by other projects or teams.

Artifact Publishing

Utilize GitLab’s artifact registry to publish and share artifacts with controlled access.

  • Define Artifacts in the CI/CD Pipeline:

    Specify the artifacts to be stored in the GitLab artifact registry in your .gitlab-ci.yml file.

    
    build: 
      stage: build 
      script: 
        - make build 
      artifacts: 
        paths: 
          - build/ 
        expire_in: 30 days
    
    • paths: Specifies the files or directories to be stored as artifacts.
    • expire_in: Sets the duration for which the artifacts are retained.
  • Control Access to Artifacts:

    • Ensure that your project visibility and member permissions are appropriately set to control access to the published artifacts.
    • Navigate to Project > Settings > General > Visibility, project features, permissions to set the appropriate visibility level (private, internal, or public) and manage access controls.

4.2 Versioning Artifacts

Manage artifact versions to track changes and facilitate rollback if necessary.

Artifact Versioning Strategy

Implement versioning conventions and tags in CI/CD pipelines for easy tracking and management.

variables:
  VERSION: "1.0.$CI_PIPELINE_ID"

build:
  stage: build
  script:
    - make build
    - mv build build-$VERSION
  artifacts:
    paths:
      - build-$VERSION/
    expire_in: 30 days