Commit 595103a
Eric Bower
·
2026-05-08 09:27:28 -0400 EDT
parent bc114f5
fix: post receive hook
2 files changed,
+11,
-3
+2,
-2
1@@ -45,8 +45,8 @@ while read -r old_sha new_sha ref; do
2 # Workspace points to the tar on pgs.sh
3 workspace="${PGS_HOST}:${tar_path}"
4
5- event=$(printf '{"type":"git.push","name":"%s","workspace":"%s","branch":"%s","commit":"%s","artifact_dest":"%s"}' \
6- "$repo" "$workspace" "$branch" "$new_sha" "$pgs_path")
7+ event=$(printf '{"type":"git.push","name":"%s","workspace":"%s","branch":"%s","commit":"%s","artifact_dest":"%s:%s"}' \
8+ "$repo" "$workspace" "$branch" "$new_sha" "$PGS_HOST" "$pgs_path")
9
10 log "publish: $event"
11 echo "$event" | ssh -T "$PIPE_HOST" pub -b=false build.event
M
main.go
+9,
-1
1@@ -1496,7 +1496,15 @@ func syncArtifacts(cfg *Cfg, log *slog.Logger) error {
2 cfg.CertificateLocation,
3 )
4 srcDir := filepath.Join(cfg.ArtifactDir, entry.Name(), repoEntry.Name())
5- cmd := exec.Command("rsync", "-e", sshArgs, "-rv", srcDir+"/", event.ArtifactDest)
6+ // Append "/" so rsync copies into the destination directory,
7+ // not as a subdirectory named after the source.
8+ dest := event.ArtifactDest
9+ if !strings.HasSuffix(dest, "/") {
10+ dest += "/"
11+ }
12+ rsyncCmd := fmt.Sprintf("rsync -e '%s' -rv %s/ %s", sshArgs, srcDir, dest)
13+ log.Info("rsync", "cmd", rsyncCmd)
14+ cmd := exec.Command("rsync", "-e", sshArgs, "-rv", srcDir+"/", dest)
15 if err := runCmd(cmd, log); err != nil {
16 log.Error("sync artifacts", "repo", entry.Name(), "job_id", repoEntry.Name(), "err", err)
17 }