Artifacts provide persistent storage for files and folders. This page explains how to store, retrieve, and view artifacts, and how to manage retention policies.
OverviewâArtifacts provide a persistent file store for all your projects. Artifacts are ideal for:
The syntax for storing files or folders in the artifact store is:
artifact push <namespace> /path/to/file/or/folder
To retrieve files or folders from the store, use:
artifact pull <namespace> <file or folder name>
Add the --force
option to overwrite files or folders during pull or push actions. For more information on syntax, see the Semaphore toolbox page.
The artifact store is partitioned into three namespaces:
The job namespace is not shared between jobs. Instead, each job is assigned a dedicated namespace for every run.
Job artifacts are ideal for storing debugging data, such as build logs, screenshots, and screencasts. In other words, use them when you don't need to share data with other jobs.
The following example shows a common combination of job and workflow artifacts:
.semaphore/semaphore.yml
version: v1.0
name: Continuous Integration Pipelines
agent:
machine:
type: f1-standard-2
os_image: ubuntu2004
blocks:
- name: Build
dependencies: []
task:
jobs:
- name: Build
commands:
- checkout
- make build
- artifact push workflow app
- name: Test
dependencies:
- Build
task:
jobs:
- name: Unit tests
commands:
- checkout
- artifact pull workflow app
- make unit
- artifact push job test.log
- name: Integration tests
commands:
- checkout
- artifact pull workflow app
- make integration
- artifact push job test.log
- name: End-to-end tests
commands:
- checkout
- artifact pull workflow app
- make e2e
- artifact push job test.log
See the YAML tab to view the commands used in the example.
Workflow artifactsâThe workflow artifact is used to pass data between jobs in the same run. This namespace is accessible to all pipelines, including those connected with promotions.
The following example shows how to use the workflow artifact to pass a compiled binary between the build, test, and deploy jobs. Note that the deploy job can access the workflow artifact even if it is in a different pipeline.
.semaphore/semaphore.yml
version: v1.0
name: Continuous Integration Pipelines
agent:
machine:
type: f1-standard-2
os_image: ubuntu2004
blocks:
- name: Build
dependencies: []
task:
jobs:
- name: Build
commands:
- checkout
- make build
- artifact push workflow app
- name: Test
dependencies:
- Build
task:
jobs:
- name: Unit tests
commands:
- checkout
- artifact pull workflow app
- make tests
promotions:
- name: Deploy
pipeline_file: deploy.yml
This is the deployment pipeline:
.semaphore/deploy.yml
version: v1.0
name: Deploy to production
agent:
machine:
type: f1-standard-2
os_image: ubuntu2004
blocks:
- name: Deploy
task:
jobs:
- name: Deploy
commands:
- checkout
- artifact pull workflow app
- make deploy
See the YAML tab to view the commands used in the example.
Project artifactsâThe project namespace is globally shared across all runs in a given project. This namespace is used to store final deliverables, such as compiled binaries.
In the following example, we use both workflow and project artifacts:
.semaphore/semaphore.yml
version: v1.0
name: Continuous Integration Pipelines
agent:
machine:
type: f1-standard-2
os_image: ubuntu2004
blocks:
- name: Build
dependencies: []
task:
jobs:
- name: Build
commands:
- checkout
- make build
- artifact push workflow app
- name: Test
dependencies:
- Build
task:
jobs:
- name: Unit tests
commands:
- checkout
- artifact pull workflow app
- make tests
- name: Release
dependencies:
- Test
task:
jobs:
- name: Save release
commands:
- artifact pull workflow app
- mv app app-$SEMAPHORE_GIT_TAG_NAME
- artifact push project app-$SEMAPHORE_GIT_TAG_NAME
See the YAML tab to view the commands used in the example.
How to view artifactsâIn addition to accessing artifacts from the job using the artifact
command, you can view, delete, and download artifacts from the Semaphore project page.
Open the job log and go to the Artifacts tab. All artifacts for this job are displayed.
Here you can:
To view the workflow artifacts, open the workflow and go to Artifacts.
Here you can:
To view the project artifacts, open your project in Semaphore and select Artifacts.
Here you can:
Semaphore will never delete your artifacts automatically. To control usage and costs, it's recommended to set up retention policies to automatically delete old artifacts.
Retention policies are rule-based and scoped to namespaces. You must create one or more rules with file selectors and ages. Semaphore attempts to match each rule to existing files and delete them if they exceed the maximum age.
How to create retention policiesâYou can access the retention policy settings in the following ways:
The retention policy menu lets you create rules for all the artifact namespaces.
To create a retention rule:
Repeat the process for the workflow artifacts:
And finally, set up retention policies for job artifacts:
info
Semaphore checks and applies the retention policy rules in your project once every day.
Retention policies selectorsâThe file selector accepts star (*
) and double-star (**
) glob patterns. For example:
/**/*
matches all files and folders in the namespace. We recommend setting this rule at the end of the list/logs/**/*.txt
matches all files with a .txt
extension in the logs folder or any subfolders/screenshots/**/*.png
matches all files with a .png
in the screenshots folder and subfoldersbuild.log
matches the file exactlyArtifacts on Semaphore Cloud are charged based on:
For more information, see Plans and Pricing
note
When using self-hosted agents, you're responsible for setting up the artifact storage bucket. Storage and transfer costs are charged by your cloud provider and depend on your infrastructure setup.
See alsoâRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4