Artifacts
Artifacts persist data after the step is completed and may be used as a storage for deployment packages.
Microtica supports three types of artifacts:
- File Artifacts
- JSON Artifacts
- Container Artifacts
File artifacts are the most common type of artifacts used to produce a deployable package that consists of plain files organized in a folder structure.
Below is an example of a pipeline step that installs node modules and compiles the source code. Once the commands are executed, a new dst/ folder will be created that contains the compiled code with the modules, and we want to package only that folder.
In this case, we’ve defined one artifact named as primary (the name is just a way to recognize multiple artifacts). The artifact will contain all the files and folders inside the local dst/ path.
Packaging content
When you want to package a whole folder recursively, make sure that you end the path with a slash (/) so Microtica can distinguish single file from whole folder packaging.
To define an artifact that contains only one specific file just provide the path to the file:
You can also select multiple files by using standard Unix filename wildcard syntax:
The above example will produce an artifact containing all files with .js extension within dst folder.
To define secondary artifacts, just specify them under files.
Microtica will automatically package, store and manage File Artifacts on encrypted, durable blob storage in the cloud.
Microtica allows you to define structured artifacts in JSON format that you can easily reference from other steps.
Basically, you define the path to the JSON file saved locally during the step execution. Then, the JSON object will become available to reference from other steps using a common JS syntax.
To demonstrate this, we can define a pipeline that first provisions a complete infrastructure in the cloud to host our SPA website and then deploy the source code on S3.
In the DeployInfra step, Terraform will generate a terraform.output file. This is a JSON file containing the outputs of the provisioned infrastructure.
The DeployWebsite step then references the outputs from the previous step by simply using ${DeployInfra.artifactsBucket} syntax. artifactsBucket is a property from terraform.output file.
Microtica will automatically store and manage JSON Artifacts on encrypted, durable blob storage in the cloud.
Microtica provides built-in support to build/push Container images on your preferred Docker registry.
To start working with Container artifacts you would first need to connect your Container registry from Microtica Console. To connect new registy go to Project Integrations -> Container Registries.
The name provided when connecting a new registry will be used in the pipeline yaml to specify the artifacts destination.
After BuildAndPushDocker step is completed, image with name my_app_image and tag v0.1.0 will be pushed to dockerhub Docker registry connected within Microtica.