Skip to content

Commit

Permalink
Move templates for cache cleanup to common-ci-configuration repo
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Sobczyk committed May 21, 2024
1 parent 84727de commit 0bc1402
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 30 deletions.
24 changes: 21 additions & 3 deletions .gitlab-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,29 @@ include:
- local: '/scripts/ci-helpers/prepare_data_image_job.yml'
- local: '/scripts/ci-helpers/mirrornet_jobs.gitlab-ci.yml'
- project: 'hive/common-ci-configuration'
ref: d34967496fcf2bb520426aba537dcd5048ad41b2
ref: 91d072682e22869aea3acd7affa20db0f6a7a2c8
file:
- '/templates/npm_projects.gitlab-ci.yml'
- '/templates/wasm_build.gitlab-ci.yml'
- '/templates/python_projects.gitlab-ci.yml'
- '/templates/cache_cleanup.gitlab-ci.yml'

.wasm_beekeeper_test_base:
extends: .job-defaults
stage: test
# emscripten image can be used as it contains all needed tools (node and npm).
image: ${EMSCRIPTEN_IMAGE}
variables:
FF_NETWORK_PER_BUILD: 1

before_script:
- . "$NVM_DIR/nvm.sh" # This loads nvm
- nvm use "${NODEJS_VERSION}"
- cd programs/beekeeper/beekeeper_wasm
- pnpm install --frozen-lockfile

tags:
- public-runner-docker

prepare_hived_image:
extends: .prepare_hived_image
Expand Down Expand Up @@ -68,15 +86,15 @@ prepare_hived_data:
- data-cache-storage

cleanup_hived_cache_manual:
extends: .cleanup_cache_manual
extends: .cleanup_cache_manual_template
stage: cleanup
variables:
CLEANUP_PATH_PATTERN: "/cache/replay_data_hive_*"
tags:
- data-cache-storage

cleanup_old_hived_cache:
extends: .cleanup_old_cache
extends: .cleanup_old_cache_template
stage: cleanup
variables:
CLEANUP_PATH_PATTERN: "/cache/replay_data_hive_*"
Expand Down
29 changes: 2 additions & 27 deletions scripts/ci-helpers/prepare_data_image_job.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
variables:
# Variables required by Common CI jobs
CI_COMMON_JOB_VERSION: "b2ff9f5a48bc8fb379c66ec4e7907ea1e796ff1b"
CI_COMMON_JOB_VERSION: "91d072682e22869aea3acd7affa20db0f6a7a2c8"
DOCKER_BUILDER_TAG: "$CI_COMMON_JOB_VERSION"
DOCKER_DIND_TAG: "$CI_COMMON_JOB_VERSION"
IMAGE_REMOVER_TAG: "$CI_COMMON_JOB_VERSION"

include:
- project: 'hive/common-ci-configuration'
ref: b2ff9f5a48bc8fb379c66ec4e7907ea1e796ff1b # develop
ref: 91d072682e22869aea3acd7affa20db0f6a7a2c8 # develop
file: '/templates/docker_image_jobs.gitlab-ci.yml'

.docker_image_builder_job:
Expand All @@ -21,31 +21,6 @@ include:
.docker_image_cleanup_job:
extends: .docker_image_cleanup_job_template

.cleanup_cache_manual:
extends: .job-defaults
image: alpine:3.16
variables:
CLEANUP_PATH_PATTERN: ""
needs: []
script:
- echo "HOSTNAME is ${HOSTNAME} CI_CONCURRENT_ID ${CI_CONCURRENT_ID}"
- du -h -d 1 /cache
- rm $CLEANUP_PATH_PATTERN -rf
when: manual

.cleanup_old_cache:
extends: .job-defaults
image: alpine:3.16
variables:
CLEANUP_PATH_PATTERN: ""
CACHE_DAYS: 7
needs: []
script:
- echo "HOSTNAME is ${HOSTNAME} CI_CONCURRENT_ID ${CI_CONCURRENT_ID}"
- du -h -d 1 /cache
- find "/cache" -maxdepth 1 -wholename "$CLEANUP_PATH_PATTERN" -mtime "+${CACHE_DAYS}"
- find "/cache" -maxdepth 1 -wholename "$CLEANUP_PATH_PATTERN" -mtime "+${CACHE_DAYS}" -exec rm -rf {} \;

.prepare_hived_image:
extends: .docker_image_builder_job

Expand Down

0 comments on commit 0bc1402

Please sign in to comment.