Skip to content

Commit

Permalink
Add the tool code
Browse files Browse the repository at this point in the history
  • Loading branch information
dimikot committed Feb 28, 2024
1 parent e50c586 commit 1cd6d75
Show file tree
Hide file tree
Showing 2 changed files with 515 additions and 0 deletions.
50 changes: 50 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: "CI Storage"
description: "Quickly stores the content of huge work directory with low percentage of changed files in the storage on a remote host, or loads the content from the storage."
inputs:
action:
description: "What to do (store or load)."
required: true
storage-host:
description: "Storage host in the format [user@]host; it must have password-free SSH key access. If not set, uses CI_STORAGE_HOST environment variable. Must not be empty eventually."
required: false
storage-dir:
description: "Storage directory on the remote host. If not set, uses CI_STORAGE_DIR environment variable. If still empty, uses the ci-storage tool default ~/ci-storage."
required: false
storage-max-age-sec:
description: "Remove slots created earlier than this many seconds ago. If not set, uses CI_STORAGE_MAX_AGE_SEC environment variable. If still empty, uses the ci-storage tool default 4 hours."
required: false
slot-id:
description: 'Id of the slot to store to or load from; use "*" to load a random most recent slot. If empty, uses "$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT" value.'
required: false
local-dir:
description: 'Local directory path to store from or load to. If not set, uses "." (the current work directory).'
required: false
exclude:
description: "Newline separated exclude pattern(s) for rsync."
required: false
verbose:
description: "If set, prints the list of transferred files."
type: boolean
required: false
runs:
using: "composite"
steps:
- name: Run ci-storage ${{ inputs.action }}
run: ci-storage \
--storage-host="$CI_STORAGE_HOST" \
--storage-dir="$CI_STORAGE_DIR" \
--storage-max-age-sec="$CI_STORAGE_MAX_AGE_SEC" \
--slot-id="$SLOT_ID" \
--local-dir="$LOCAL_DIR" \
--exclude="$EXCLUDE" \
$VERBOSE \
"${{ inputs.action }}"
shell: bash
env:
CI_STORAGE_HOST: ${{ inputs.storage-host || env.CI_STORAGE_HOST || "" }}
CI_STORAGE_DIR: ${{ inputs.storage-dir || env.CI_STORAGE_DIR || "" }}
CI_STORAGE_MAX_AGE_SEC: ${{ inputs.storage-max-age-sec || env.CI_STORAGE_MAX_AGE_SEC || "" }}
SLOT_ID: ${{ inputs.slot-id || format("{0}-{1}", env.GITHUB_RUN_ID, env.GITHUB_RUN_ATTEMPT) }}
LOCAL_DIR: ${{ inputs.local-dir || "." }}
EXCLUDE: ${{ inputs.exclude || "" }}
VERBOSE: ${{ inputs.verbose && "--verbose" || "" }}
Loading

0 comments on commit 1cd6d75

Please sign in to comment.