Skip to content

Commit 6ffb946

Browse files
authored
Merge pull request #47 from fluxcd/revision-fix
git: fix revision for git tags
2 parents 56b264e + 62d3469 commit 6ffb946

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o source-c
2020

2121
FROM alpine:3.11
2222

23-
RUN apk add --no-cache openssh-client ca-certificates tini 'git>=2.12.0' socat curl bash
23+
RUN apk add --no-cache openssh-client ca-certificates tar tini 'git>=2.12.0' socat curl bash
2424

2525
COPY --from=builder /workspace/source-controller /usr/local/bin/
2626

controllers/gitrepository_controller.go

+3
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,9 @@ func (r *GitRepositoryReconciler) sync(ctx context.Context, repository sourcev1.
321321

322322
if revision == "" {
323323
revision = fmt.Sprintf("%s/%s", branch, ref.Hash().String())
324+
if repository.Spec.Reference.Tag != "" {
325+
revision = fmt.Sprintf("%s/%s", repository.Spec.Reference.Tag, ref.Hash().String())
326+
}
324327
}
325328

326329
artifact := r.Storage.ArtifactFor(repository.Kind, repository.ObjectMeta.GetObjectMeta(),

0 commit comments

Comments
 (0)