From 12d25ca47a54f92494e39b5b24dd43daa4fb6e18 Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Sun, 12 Apr 2020 09:56:52 +0300 Subject: [PATCH] Add symlink for latest Git artifact --- controllers/gitrepository_controller.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/controllers/gitrepository_controller.go b/controllers/gitrepository_controller.go index 353ef837..18b79d0e 100644 --- a/controllers/gitrepository_controller.go +++ b/controllers/gitrepository_controller.go @@ -299,6 +299,13 @@ func (r *GitRepositoryReconciler) sync(repository sourcev1.GitRepository) (sourc return NotReadyCondition(sourcev1.StorageOperationFailedReason, err.Error()), "", err } + // update latest symlink + err = r.Storage.Symlink(artifact, "latest.tar.gz") + if err != nil { + err = fmt.Errorf("storage error %w", err) + return NotReadyCondition(sourcev1.StorageOperationFailedReason, err.Error()), "", err + } + message := fmt.Sprintf("Artifact is available at %s", artifact.Path) return ReadyCondition(sourcev1.GitOperationSucceedReason, message), artifact.URL, nil }