Core Concepts
Pipelines
Artifacts
9min
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 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 microtica yaml steps step name artifacts files \[artifact name] \[path to folder or files] 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 microtica yaml steps buildnodeapp image node\ latest commands \ npm install \ npm run build artifacts files primary dst/ 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 microtica yaml steps buildnodeapp image node\ latest commands \ npm install \ npm run build artifacts files primary dst/index js you can also select multiple files by using standard unix filename wildcard syntax microtica yaml steps buildnodeapp image node\ latest commands \ npm install \ npm run build artifacts files primary dst/ js 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 yaml artifacts files primary /dst assets artifact /assets microtica will automatically package, store and manage file artifacts on encrypted, durable blob storage in the cloud json artifacts 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 microtica yaml artifacts json \[path to json file] 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 microtica yaml steps deployinfra title provision spa infrastructure on aws image hashicorp/terraform\ latest commands \ terraform init \ terraform apply auto approve \ terraform output json > terraform output artifacts json terraform output deploywebsite title deploy spa website image aws/codebuild/standard 4 0 commands \ echo website is being deployed \# reference json artifacts from deployinfra step \ aws s3 sync ${deployinfra artifactsbucket} \ aws cloudfront create invalidation distribution id ${deployinfra cdnid} 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 container artifacts 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 microtica yaml steps buildandpushdocker type docker push image name microtica/my app tag v0 1 0 dockerfile dockerfile \# optional, if not specified, default will be used registry dockerhub 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