Skip to content

harness-community/drone-archive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

archive-plugin

Synopsis

This repository contains a plugin for running archive functionalities like zip/tar/gzip.

Plugin Image

The plugin plugins/archive is available for the following architectures:

OS Tag
latest latest
linux/amd64 linux-amd64
linux/arm64 linux-arm64
windows/amd64 windows-amd64

Parameters

Parameter Comments
source
required
source path
target
required
target path
format
required
zip/tar/gzip
action
required
archive or extract
tarcompress
optional
true or false (compression for tar)
glob
optional
Ant style pattern of files to extract/archive from the zip/tar. Leave empty to include all files and directories.
exclude
optional
Ant style pattern of files to exclude from the zip/tar.
overwrite
optional
true of false

Building

Build the plugin image:

./scripts/build.sh

Examples

docker run \
  -e PLUGIN_SOURCE=/data/source \
  -e PLUGIN_TARGET=/data/backup/archive.zip \
  -e PLUGIN_FORMAT=zip \
  -e PLUGIN_ACTION=archive \
  -e PLUGIN_OVERWRITE=true \
  -e PLUGIN_EXCLUDE="*.log" \
  -e PLUGIN_GLOB="**/*.txt" \
  plugins/archive
  
docker run \
  -e PLUGIN_SOURCE=/data/backup/archive.zip \
  -e PLUGIN_TARGET=/data/source \
  -e PLUGIN_FORMAT=zip \
  -e PLUGIN_ACTION=extract \
  -e PLUGIN_OVERWRITE=true \
  -e PLUGIN_GLOB="**/*.txt" \
  plugins/archive
  
docker run \
  -e PLUGIN_SOURCE=/data/source \
  -e PLUGIN_TARGET=/data/backup/archive.tar \
  -e PLUGIN_FORMAT=tar \
  -e PLUGIN_ACTION=archive \
  -e PLUGIN_OVERWRITE=true \
  -e PLUGIN_EXCLUDE="*.log" \
  -e PLUGIN_GLOB="**/*.txt" \
  -e PLUGIN_TARCOMPRESS=false \
  plugins/archive
  
docker run \
  -e PLUGIN_SOURCE=/data/backup/archive.tar \
  -e PLUGIN_TARGET=/data/source \
  -e PLUGIN_FORMAT=tar \
  -e PLUGIN_ACTION=extract \
  -e PLUGIN_OVERWRITE=true \
  -e PLUGIN_GLOB="**/*.txt" \
  plugins/archive
  
docker run \
  -e PLUGIN_SOURCE=/data/source \
  -e PLUGIN_TARGET=/data/backup/archive.tar.gz \
  -e PLUGIN_FORMAT=tar \
  -e PLUGIN_ACTION=archive \
  -e PLUGIN_OVERWRITE=true \
  -e PLUGIN_TARCOMPRESS=true \
  -e PLUGIN_EXCLUDE="*.log" \
  -e PLUGIN_GLOB="**/*.txt" \
  plugins/archive
  
# Plugin YAML
- step:
    type: Plugin
    name: archive-plugin-arm64
    identifier: archive-plugin-arm64
    spec:
        connectorRef: harness-docker-connector
        image: plugins/archive:linux-arm64
        settings:
            source: path/to/source
            target: targetpath
            format: zip/tar/gzip
            action: archive or extract
            glob: Some ant style pattern to include those files
            exclude: Some ant style pattern to exclude those files
            overwrite: true/false