Skip to content

Latest commit

 

History

History
72 lines (48 loc) · 1.62 KB

expire-artifacts.md

File metadata and controls

72 lines (48 loc) · 1.62 KB

Expire Artifacts

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.

Job Type

The job_type defines type of the job, e.g.

job_type: artifacts-expiration

Cron Schedule

The cron_trigger defines schedule to run this job periodically, e.g. it will run above job every hour.

cron_trigger: 0 * * * *

Tasks

The tasks section define the DAG or workflow of the build job where each specifies details for each build step such as:

Task Type

The task_type defines name of the task, e.g.

- task_type: expire
Method

The method defines type of tasklet to run, e.g.

  method: EXPIRE_ARTIFACTS

Uploading Job Definition

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.

Submitting Job Request Manually

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