Following example shows how to use EXPIRE_ARTIFACTS
method to expire old artifacts:
job_type: artifacts-expiration
cron_trigger: 0 * * * *
tasks:
- task_type: expire
method: EXPIRE_ARTIFACTS
Note: This is meant for internal operational purpose.
The job_type
defines type of the job, e.g.
job_type: artifacts-expiration
The cron_trigger
defines schedule to run this job periodically, e.g. it will run above job every hour.
cron_trigger: 0 * * * *
The tasks section define the DAG or workflow of the build job where each specifies details for each build step such as:
The task_type
defines name of the task, e.g.
- task_type: expire
The method
defines type of tasklet to run, e.g.
method: EXPIRE_ARTIFACTS
You can store the job configuration in a YAML
file and then upload using dashboard or API such as:
curl -v -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/yaml" \
--data-binary @artifacts-expiration.yaml $SERVER/api/jobs/definitions
You will need to create an API token to access the API using Authentication to the API sever defined by $SERVER environment variable passing token via $TOKEN environment variable.
You can then submit the job as follows:
curl -v -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
--data '{"job_type": "artifacts-expiration" }' $SERVER/api/jobs/requests