-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(copy): add copy policy. #45
Conversation
Adds the "copy" policy to allow users to copy files from git repositories into local files. Signed-off-by: José Guilherme Vanz <jguilhermevanz@suse.com>
Is there any reason why we can't reuse https://github.com/updatecli/policies/tree/main/updatecli/policies/file ?
|
Sorry I meant the other scm
and the action
|
I've tried to do that using the file policy. I've applied this diff: diff --git a/updatecli/policies/file/updatecli.d/default.yaml b/updatecli/policies/file/updatecli.d/default.yaml
index 0af4fc9..4f193c9 100644
--- a/updatecli/policies/file/updatecli.d/default.yaml
+++ b/updatecli/policies/file/updatecli.d/default.yaml
@@ -1,9 +1,11 @@
---
# Helpers
+# {{ if .scm }}
# {{ $GitHubUser := env ""}}
# {{ $GitHubRepositoryList := env "GITHUB_REPOSITORY" | split "/"}}
# {{ $GitHubPAT := env "GITHUB_TOKEN"}}
# {{ $GitHubUsername := env "GITHUB_ACTOR"}}
+# {{ end }}
# {{ $DefaultTitle := (print "chore: sync file(s) from " .src.url ) }}
name: '{{ default $DefaultTitle .title }}'
@@ -12,6 +14,7 @@ name: '{{ default $DefaultTitle .title }}'
pipelineid: '{{ .pipelineid }}'
# {{ end }}
+# {{ if .scm }}
# scms defines the source control management system to interact with.
scms:
default:
@@ -50,6 +53,7 @@ scms:
#{{ if .scm.commitmessage.scope }}
scope: '{{ .scm.commitmessage.scope }}'
# {{ end }}
+# {{ end }}
# {{ end }}
source:
kind: git
@@ -62,7 +66,9 @@ sources:
# {{ range $index, $file := .files }}
{{ $index }}:
name: 'Get {{$file.src }} from source repository'
+# {{ if .scm }}
scmid: 'source'
+# {{ end }}
kind: 'file'
spec:
file: '{{ $file.src }}'
@@ -74,13 +80,16 @@ targets:
"{{ $index }}":
name: 'sync {{ $file.dst }} file'
kind: 'file'
+# {{ if .scm }}
scmid: 'default'
+# {{ end }}
sourceid: '{{ $index }}'
spec:
file: '{{ $file.dst }}'
forcecreate: true
# {{ end }}
+# {{ if .scm }}
# actions defines what to do when a target with the same scmid is modified.
actions:
default:
@@ -100,3 +109,4 @@ actions:
# {{ end }}
# {{ end }}
scmid: "default"
+# {{ end }} And used this values file: ---
title: "chore: sync file from source repository"
files:
- src: "cli-docs.md"
dst: "/tmp/kwctl-cli.md"
src:
branch: "main"
url: "https://github.com/kubewarden/kwctl.git" However, when I run the template: cfg:24: undefined variable "$GitHubUser"
ERROR: failed loading pipeline(s)
* "updatecli.d/default.yaml" - template: cfg:24: undefined variable "$GitHubUser"
0 pipeline(s) successfully loaded
SCM repository retrieved: 0
It looks to me that even if I put all the scm and github references under the Am I doing something wrong? 😅 |
You can run Let me open a pullrequest as I think I have something working |
I just open #46 |
Superseded by #46 |
Description
Adds the "copy" policy to allow users to copy files from git repositories into local files.