Merge pull request #47 from fluxcd/revision-fix

git: fix revision for git tags
This commit is contained in:
Stefan Prodan 2020-04-28 20:41:10 +03:00 committed by GitHub
commit 6ffb946c54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -20,7 +20,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o source-c
FROM alpine:3.11
RUN apk add --no-cache openssh-client ca-certificates tini 'git>=2.12.0' socat curl bash
RUN apk add --no-cache openssh-client ca-certificates tar tini 'git>=2.12.0' socat curl bash
COPY --from=builder /workspace/source-controller /usr/local/bin/

View File

@ -321,6 +321,9 @@ func (r *GitRepositoryReconciler) sync(ctx context.Context, repository sourcev1.
if revision == "" {
revision = fmt.Sprintf("%s/%s", branch, ref.Hash().String())
if repository.Spec.Reference.Tag != "" {
revision = fmt.Sprintf("%s/%s", repository.Spec.Reference.Tag, ref.Hash().String())
}
}
artifact := r.Storage.ArtifactFor(repository.Kind, repository.ObjectMeta.GetObjectMeta(),