Remove artifacts from CI manually

user1251007

I have a private repository at gitlab.com that uses the CI feature. Some of the CI jobs create artifacts files that are stored. I just implemented that the artifacts are deleted automatically after one day by adding this to the CI configuration:

expire_in: 1 day

That works great - however, old artifacts won't be deleted (as expected). So my question is:

How can I delete old artifacts or artifacts that do not expire? (on gitlab.com, no direct access to the server)

David Archer

You can use the GitLab REST API to delete the artifacts from the jobs if you don't have direct access to the server. Here's a sample curl script that uses the API:

#!/bin/bash

# project_id, find it here: https://gitlab.com/[organization name]/[repository name]/edit inside the "General project settings" tab
project_id="3034900"

# token, find it here: https://gitlab.com/profile/personal_access_tokens
token="Lifg_azxDyRp8eyNFRfg"
server="gitlab.com"

# go to https://gitlab.com/[organization name]/[repository name]/-/jobs
# then open JavaScript console
# copy/paste => copy(_.uniq($('.ci-status').map((x, e) => /([0-9]+)/.exec(e.href)).toArray()).join(' '))
# press enter, and then copy the result here :
# repeat for every page you want
job_ids=(48875658 48874137 48873496 48872419)

for job_id in ${job_ids[@]};
do
 URL="https://$server/api/v4/projects/$project_id/jobs/$job_id/erase"
 echo "$URL"
 curl --request POST --header "PRIVATE-TOKEN:${token}" "$URL"
 echo "\n"
done

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Remove letter artifacts from an image

How to remove OCR artifacts from text?

Remove Catkin artifacts from CPack build

How to publish Travis CI artifacts to GitHub Release from several jobs

gitlab ci: Pass artifacts from two jobs of the same stage

Create specifc folder from Gitlab CI artifacts after building with Gulp

Is there a way to download compilation artifacts from a travis-ci build?

Gitlab ci artifacts not found

Heroku CI build artifacts

Something like “mvn undeploy” to remove artifacts from Nexus?

How to remove version from IntelliJ IDEA Gradle artifacts?

Gitlab CI Angular Artifacts not accessible

Remove index.php from CI in subdirectory

How to publish artifacts separately for each project in solution from VSTS CI pipeline?

how can we configure to pull npm packages from Jfrog artifacts for yaml based azure CI Pipeline?

How to manually publish a file to Azure Artifacts?

Is there anyway to manually cache remote artifacts in Artifactory?

Is it safe to remove manually installed Python 2.7 from Yosemite?

How to disallow user to remove HTML element manually from DOM?

Do you need to manually remove a connection from a SignalR group on disconnect?

Can I add and remove features manually from CountVectorizer?

OpenCV remove background noise and artifacts

How to remove mammography tag artifacts

Angular 2+: how to remove all angular attributes and comments (and other angular artifacts) from the HTML code?

Signing generated artifacts on Travis-CI

Gitlab ci - differences in artifacts app jar

Managing (older) CI artifacts in GitLab CE Omnibus

What is the correct usage of cache/artifacts in Gitlab CI?

GitLab CI Build not uploading artifacts of codeception

TOP Ranking

HotTag

Archive