Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only commit changed packages to master #341

Merged
merged 3 commits into from
Jan 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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