-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathaction.yml
More file actions
79 lines (77 loc) · 3.41 KB
/
Copy pathaction.yml
File metadata and controls
79 lines (77 loc) · 3.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: "SyncerD"
description: "Sync Docker images between registries, or mirror git repositories between hosting providers."
author: "CloudDrove"
branding:
icon: "package"
color: "blue"
inputs:
command:
description: "Subcommand to run: sync (Docker registry sync) or git-sync (git repository mirroring)"
required: false
default: "sync"
config:
description: "Path to syncerd.yaml"
required: false
default: "syncerd.yaml"
once:
description: "Run once and exit (true/false)"
required: false
default: "true"
dry-run:
description: "Report what would be created, pushed, and pruned without writing anything. git-sync only."
required: false
default: "false"
report:
description: "Write a machine readable JSON report of the run to this path. Empty disables it."
required: false
default: ""
metrics-file:
description: "Write Prometheus textfile collector metrics for the last run to this path. Empty disables it."
required: false
default: ""
log-format:
description: "Log output format: text or json."
required: false
default: "text"
runs:
using: "docker"
# Marketplace best practice is to pin to a major tag, but v1 has not been
# released yet (project is still 0.x). The release workflow's
# type=semver,pattern=v{{major}} produces v0 for the current line; this
# must move to v1 once a 1.0 release ships.
image: "docker://ghcr.io/clouddrove/syncerd:v0"
# args is a fixed list: it cannot branch on inputs.command at the shell
# level, only per element via an expression. --dry-run exists on git-sync
# only, so it cannot simply be appended: an unconditional --dry-run would
# be an unknown flag on sync and break every existing image sync workflow.
# The element below evaluates to "--dry-run=<value>" when command is
# git-sync, and to an empty string otherwise. An empty string element is
# still passed to the binary as its own argv entry, but neither command
# has a positional-argument validator (cobra's default Args is
# ArbitraryArgs), so it is silently ignored; confirmed by running the
# built binary with a trailing empty-string argument and getting the
# normal "at least one destination is required" error, not an argument
# parsing error. This is a guarded invariant, not just a comment: see
# TestCommandsTolerateEmptyPositionalArg in main_test.go. If that test
# ever fails, this args list must change in the same commit, or an Args
# validator added to either command will break every image sync workflow
# the next time the Action image is published.
#
# Hyphenated input names (dry-run, metrics-file, log-format) must be read
# with bracket syntax, inputs['name'], not inputs.name: the expression
# parser reads the hyphen in dot notation as subtraction.
#
# The conditional expression below is asserted, with literal values, by
# the "dry run expression resolves correctly" step in
# .github/workflows/action-smoke.yml. If you change this expression,
# update that step's literals to match, or the workflow will stop
# guarding what it says it guards.
args:
- "${{ inputs.command }}"
- "--config"
- "${{ inputs.config }}"
- "--once=${{ inputs.once }}"
- "${{ inputs.command == 'git-sync' && format('--dry-run={0}', inputs['dry-run']) || '' }}"
- "--report=${{ inputs.report }}"
- "--metrics-file=${{ inputs['metrics-file'] }}"
- "--log-format=${{ inputs['log-format'] }}"