Creating artifacts¶
Introduction¶
To successfully use the Artifact deployment method, your project must create package releases containing artifacts ready for deployment. This guide explains how to set up your project for this purpose.
Setting up your .gitlab-ci.yml
file¶
The Dropsolid Experience Cloud uses GitLab to host projects and checks for
any dxp-
prefixed packages that contain files to expose as
options in the 'Deploy' shortcut popup. When a
package contains duplicate assets, only the last asset is shown to deploy.
These packages are created using GitLab pipelines, which require a correctly
configured .gitlab-ci.yml
file.
While there are no strict requirements for the package or compressed artifact file, the file must be
a generic package and should either be a .zip
or .gz
format.
However, we provide default configurations in our component library to simplify and expedite the process of creating a pipeline compatible with the Artifact deployment method.
Example .gitlab-ci.yml
¶
Below is a minimal example for a PHP project that uses composer
to manage dependencies (e.g., Drupal, Mautic). In this
setup, the project does not commit vendor dependencies to the repository; instead, it builds them during the build
stage. The artifact stages then compress all necessary files into an release.tar.gz
file and push it to the package
registry for deployment.
stages:
- build
- build-artifact
- push-artifact
include:
# Includes a component that runs `composer install` in the
# `build` stage with dev and production dependencies.
# If your project does not require external dependencies (e.g., HTML),
# you can skip or modify this step.
- component: $CI_SERVER_FQDN/resources/dxp-ci-catalog/composer-build@~latest
inputs:
php_version: '8.2'
# Includes a component to build and push the artifact to
# the package registry.
- component: $CI_SERVER_FQDN/resources/dxp-ci-catalog/create-artifact-release@~latest
# Ensures the artifact release build job depends on the composer build job.
create-artifact-release:build:
dependencies:
- composer-build:composer-install-prod
Customizing the pipeline¶
You can override each part of the provided components. By default, the artifact components will run on every push. To change this behavior, modify the rules key in the included jobs. Below is an example to only run the pipeline for merge request events.
include:
- component: $CI_SERVER_FQDN/resources/dxp-ci-catalog/create-artifact-release@~latest
create-artifact-release:build:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
create-artifact-release:push:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
Package naming conventions¶
A package is created per branch, and one package for the tagged commits. For branch packages, the latest version will be overridden with a new package. For packages generated from a tagged commit a new version is created for each tag.