Skip to content

Commit

Permalink
Merge pull request #341 from mesosphere/jimmi/cleaner-git-log
Browse files Browse the repository at this point in the history
Only commit changed packages to master
  • Loading branch information
makkes authored Jan 10, 2020
2 parents dd88531 + e01ab7d commit d941764
Show file tree
Hide file tree
Showing 157 changed files with 19 additions and 2,491 deletions.
34 changes: 19 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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")
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
Empty file removed docs/.gitignore
Empty file.
Binary file removed docs/stable/awsebscsiprovisioner-0.1.0.tgz
Binary file not shown.
Binary file removed docs/stable/awsebscsiprovisioner-0.2.0.tgz
Binary file not shown.
Binary file removed docs/stable/awsebscsiprovisioner-0.2.2.tgz
Binary file not shown.
Binary file removed docs/stable/awsebscsiprovisioner-0.2.3.tgz
Binary file not shown.
Binary file removed docs/stable/awsebscsiprovisioner-0.2.4.tgz
Binary file not shown.
Binary file removed docs/stable/awsebscsiprovisioner-0.2.5.tgz
Binary file not shown.
Binary file removed docs/stable/awsebscsiprovisioner-0.2.6.tgz
Binary file not shown.
Binary file removed docs/stable/awsebscsiprovisioner-0.2.7.tgz
Binary file not shown.
Binary file removed docs/stable/awsebscsiprovisioner-0.2.8.tgz
Binary file not shown.
Binary file removed docs/stable/awsebscsiprovisioner-0.2.9.tgz
Binary file not shown.
Binary file removed docs/stable/awsebscsiprovisioner-0.3.0.tgz
Binary file not shown.
Binary file removed docs/stable/awsebscsiprovisioner-0.3.1.tgz
Binary file not shown.
Binary file removed docs/stable/awsebsprovisioner-0.1.0.tgz
Binary file not shown.
Binary file removed docs/stable/awsebsprovisioner-0.1.1.tgz
Binary file not shown.
Binary file removed docs/stable/awsebsprovisioner-0.1.2.tgz
Binary file not shown.
Binary file removed docs/stable/awsebsprovisioner-0.1.3.tgz
Binary file not shown.
Binary file removed docs/stable/dex-1.5.2.tgz
Binary file not shown.
Binary file removed docs/stable/dex-1.5.3.tgz
Binary file not shown.
Binary file removed docs/stable/dex-1.5.4.tgz
Binary file not shown.
Binary file removed docs/stable/dex-1.6.0.tgz
Binary file not shown.
Binary file removed docs/stable/dex-1.6.1.tgz
Binary file not shown.
Binary file removed docs/stable/dex-1.6.2.tgz
Binary file not shown.
Binary file removed docs/stable/dex-1.6.3.tgz
Binary file not shown.
Binary file removed docs/stable/dex-1.6.4.tgz
Binary file not shown.
Binary file removed docs/stable/dex-1.6.5.tgz
Binary file not shown.
Binary file removed docs/stable/dex-controller-0.1.1.tgz
Binary file not shown.
Loading

0 comments on commit d941764

Please sign in to comment.