Skip to content

Commit

Permalink
Add flag to force-overwrite existing chart files.
Browse files Browse the repository at this point in the history
This mitigates issue #5.
  • Loading branch information
headcr4sh committed Oct 30, 2018
1 parent 7aed053 commit 400677c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [0.4.1] - 2018-10-30

### Added

- Possiblity to force-upload charts even if the version of the chart already
exists. (Mitigates issue [5](https://github.com/cathive/concourse-chartmuseum-resource/issues/5))

## [0.4.0] - 2018-09-13

### Added
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:10.9.0 as builder
FROM node:10.12.0 as builder
RUN apt-get -y update && apt-get -y install curl gzip tar unzip
ARG HELM_DOWNLOAD_URL="https://storage.googleapis.com/kubernetes-helm/helm-v2.10.0-linux-amd64.tar.gz"
ADD ${HELM_DOWNLOAD_URL} /tmp/helm.tar.gz
Expand All @@ -13,7 +13,7 @@ COPY . /src
WORKDIR /src
RUN npm -s install && npm -s run build && npm -s test && npm -s pack && mv cathive-concourse-chartmuseum-resource-*.tgz /data/cathive-concourse-chartmuseum-resource.tgz

FROM node:10.9.0-alpine
FROM node:10.12.0-alpine
RUN apk add --no-cache gnupg ca-certificates
COPY --from=builder "/data/helm" "/usr/local/bin/helm"
COPY --from=builder "/data/cathive-concourse-chartmuseum-resource.tgz" "/tmp/cathive-concourse-chartmuseum-resource.tgz"
Expand All @@ -26,8 +26,8 @@ RUN npm -s install -g /tmp/cathive-concourse-chartmuseum-resource.tgz \
ENV PATH="/usr/local/bin:/usr/bin:/bin"
RUN helm init --client-only
LABEL maintainer="Benjamin P. Jung <headcr4sh@gmail.com>" \
version="0.4.1-pre" \
org.concourse-ci.target-version="4.0.0" \
version="0.4.1" \
org.concourse-ci.target-version="4.2.1" \
org.concourse-ci.resource-id="chartmuseum" \
org.concourse-ci.resource-name="ChartMuseum package management" \
org.concourse-ci.resource-homepage="https://github.com/cathive/concourse-chartmuseum-resource"
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ unless overwritten by the parameter `target_basename`.
uploaded. If a folder has been specified instead of a tgz file, this folder will be
packaged prior to uploading it's contents to the ChartMuseum instance.

* `force`: Optional parameter that can be used to force the upload of the chart,
even if the version to be uploaded does already exist on the server. Enforcement
only works, if the ChartMuseum server has *not* been started with the
`--disable-force-overwrite` flag, though.

* `version`: Optional parameter that can be used to override the "version" field in the
chart's `Chart.yaml` file. If the override version is stored in a file, you can use the
parameter `version_file` instead.
Expand Down
1 change: 1 addition & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export interface OutRequest extends Request {
key_passphrase?: string
version?: string
version_file?: string
force?: boolean
}
}

Expand Down
5 changes: 4 additions & 1 deletion out.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,10 @@ export default async function out(): Promise<{ data: Object, cleanupCallback: ((
const readStream = fs.createReadStream(chartFile);
let postResult: Response;
try {
const postUrl = `${request.source.server_url}api/charts`;
let postUrl = `${request.source.server_url}api/charts`;
if (request.params.force) {
postUrl += "?force=true"
}
postResult = await fetch(postUrl, {
method: "POST",
headers: headers,
Expand Down

0 comments on commit 400677c

Please sign in to comment.