-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #341 from mesosphere/jimmi/cleaner-git-log Only co…
…mmit changed packages to master
- Loading branch information
root
committed
Jan 10, 2020
1 parent
9b378da
commit dd9f79e
Showing
39 changed files
with
399 additions
and
395 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ STABLE_TARGETS = $(shell hack/chart_destination.sh $(STABLE_CHARTS)) | |
STAGING_CHARTS = $(wildcard staging/*/Chart.yaml) | ||
STAGING_TARGETS = $(shell hack/chart_destination.sh $(STAGING_CHARTS)) | ||
|
||
GIT_REMOTE_URL ?= https://mesosphere:$(GITHUB_USER_TOKEN)@github.com/mesosphere/charts.git | ||
GIT_REMOTE_URL ?= $(shell git remote get-url origin) | ||
|
||
# Extract the github user from the origin remote url. | ||
# This let's the 'publish' task work with forks. | ||
|
@@ -14,8 +14,9 @@ GIT_REMOTE_URL ?= https://mesosphere:$(GITHUB_USER_TOKEN)@github.com/mesosphere/ | |
# - [email protected]:mesosphere/charts.git | ||
GITHUB_USER := $(shell git remote get-url origin | sed -E 's|.*github.com[/:]([^/]+)/charts.*|\1|') | ||
|
||
GIT_REF = $(shell git show-ref -s HEAD) | ||
LAST_COMMIT_MESSAGE := $(shell git reflog -1 | sed 's/^.*: //') | ||
GIT_REF = $(shell git rev-parse HEAD) | ||
LAST_COMMIT_MESSAGE := $(shell git log -1 --pretty=format:'%B') | ||
NON_DOCS_FILES := $(filter-out docs,$(wildcard *)) | ||
|
||
TMPDIR := $(shell mktemp -d) | ||
HELM := $(shell bash -c "command -v helm") | ||
|
@@ -52,14 +53,16 @@ stablerepo: $(STABLE_TARGETS) | docs/stable/index.yaml | |
.PHONY: publish | ||
publish: | ||
-git remote add publish $(GIT_REMOTE_URL) >/dev/null 2>&1 | ||
-@git branch -D master | ||
@git checkout -b master | ||
@curl -Ls https://github.com/mesosphere/charts/archive/master.tar.gz | tar -xz --strip-components=1 charts-master/docs | ||
@make all | ||
@git add . | ||
@git commit -m "$(LAST_COMMIT_MESSAGE)" | ||
@git push -f publish master | ||
@git checkout - | ||
-git branch -D master | ||
git checkout -b master | ||
git fetch publish master | ||
git reset --hard publish/master | ||
git checkout $(GIT_REF) -- $(NON_DOCS_FILES) | ||
make all | ||
git add -A . | ||
git commit -m "$(LAST_COMMIT_MESSAGE)" | ||
git push publish master | ||
git checkout - | ||
|
||
$(HELM): | ||
ifeq ($(HELM),$(TMPDIR)/helm) | ||
|
@@ -73,20 +76,21 @@ endif | |
# - Untarring the package | ||
# - Recreate the package using `tar`, speficying time of the last git commit to the package | ||
# source as the files' mtime, as well as ordering files deterministically, meaning that unchanged | ||
# content will result in the same output package. | ||
# content will result in the same output package | ||
# - Use `gzip -n` to prevent any timestamps being added to `gzip` headers in archive. | ||
$(STABLE_TARGETS) $(STAGING_TARGETS): $$(wildcard $$(patsubst docs/%.tgz,%/*,$$@)) $$(wildcard $$(patsubst docs/%.tgz,%/*/*,$$@)) | ||
$(STABLE_TARGETS) $(STAGING_TARGETS): $(TMPDIR)/.helm/repository/local/index.yaml | ||
@mkdir -p $(shell dirname $@) | ||
$(eval PACKAGE_SRC := $(shell echo $@ | sed 's@docs/\(.*\)-[v0-9][0-9.]*.tgz@\1@')) | ||
$(eval UNPACKED_TMP := $(shell mktemp -d)) | ||
$(HELM) --home $(TMPDIR)/.helm package $(PACKAGE_SRC) -d $(shell dirname $@) | ||
tar -xzmf $@ -C $(UNPACKED_TMP) | ||
tar -czf $@ \ | ||
--owner=root --group=root --numeric-owner \ | ||
tar -c \ | ||
--owner=root:0 --group=root:0 --numeric-owner \ | ||
--no-recursion \ | ||
--mtime="@$(shell git log -1 --format="%at" $(PACKAGE_SRC))" \ | ||
-C $(UNPACKED_TMP) \ | ||
$$(find $(UNPACKED_TMP) -printf '%P\n' | sort) | ||
$$(find $(UNPACKED_TMP) -printf '%P\n' | sort) | gzip -n > $@ | ||
rm -rf $(UNPACKED_TMP) | ||
|
||
%/index.yaml: $(STABLE_TARGETS) $(STAGING_TARGETS) | ||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.