ansible
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
CMDS += copy master-tag release release-check release-create release-finish subrepo-push subrepo-update
|
||||
CONTEXT += APPS ENV RELEASE
|
||||
CONTEXT += APPS DOMAIN RELEASE
|
||||
DIRS ?= $(CONFIG) $(MAKE_DIR) $(SHARED)
|
||||
RELEASE_UPGRADE ?= $(filter v%, $(shell git tag -l 2>/dev/null |sort -V |awk '/$(RELEASE)/,0'))
|
||||
RELEASE_VERSION ?= $(firstword $(subst -, ,$(VERSION)))
|
||||
|
||||
+15
-15
@@ -3,10 +3,10 @@
|
||||
|
||||
# target subrepo-branch-delete: Delete branch $(BRANCH) on remote $(SUBREPO)
|
||||
.PHONY: subrepo-branch-delete
|
||||
subrepo-branch-delete: $(if $(DOCKER_RUN),myos-base) subrepo-check
|
||||
subrepo-branch-delete: myos-base subrepo-check
|
||||
ifneq ($(words $(BRANCH)),0)
|
||||
$(call exec,[ $$(git ls-remote --heads $(REMOTE) $(BRANCH) 2>/dev/null |wc -l) -eq 1 ]) \
|
||||
&& $(call exec,$(RUN) git push $(REMOTE) :$(BRANCH))
|
||||
[ $$(git ls-remote --heads $(REMOTE) $(BRANCH) 2>/dev/null |wc -l) -eq 1 ] \
|
||||
&& $(RUN) git push $(REMOTE) :$(BRANCH)
|
||||
endif
|
||||
|
||||
# target subrepo-check: Define SUBREPO and REMOTE
|
||||
@@ -28,21 +28,21 @@ endif
|
||||
.PHONY: subrepo-git-diff
|
||||
subrepo-git-diff: myos-base subrepo-check
|
||||
$(eval IGNORE_DRYRUN := true)
|
||||
$(eval DIFF = $(shell $(call exec,git diff --quiet $(shell $(call exec,git rev-list --ancestry-path $(shell awk '$$1 == "parent" {print $$3}' $(SUBREPO)/.gitrepo)..HEAD |tail -n 1)) -- $(SUBREPO); printf '$$?\n')) )
|
||||
$(eval DIFF = $(shell git diff --quiet $(shell git rev-list --ancestry-path $(shell awk '$$1 == "parent" {print $$3}' $(SUBREPO)/.gitrepo)..HEAD |tail -n 1) -- $(SUBREPO); printf '$$?\n') )
|
||||
$(eval IGNORE_DRYRUN := false)
|
||||
|
||||
# target subrepo-git-fetch: Fetch git remote
|
||||
.PHONY: subrepo-git-fetch
|
||||
subrepo-git-fetch: myos-base subrepo-check
|
||||
$(call exec,$(RUN) git fetch --prune $(REMOTE))
|
||||
$(RUN) git fetch --prune $(REMOTE)
|
||||
|
||||
# target subrepo-tag-create-%: Create tag TAG to reference branch REMOTE/%
|
||||
.PHONY: subrepo-tag-create-%
|
||||
subrepo-tag-create-%: myos-base subrepo-check subrepo-git-fetch
|
||||
ifneq ($(words $(TAG)),0)
|
||||
$(call exec,[ $$(git ls-remote --tags $(REMOTE) $(TAG) |wc -l) -eq 0 ]) \
|
||||
|| $(call exec,$(RUN) git push $(REMOTE) :refs/tags/$(TAG))
|
||||
$(call exec,$(RUN) git push $(REMOTE) refs/remotes/subrepo/$(SUBREPO)/$*:refs/tags/$(TAG))
|
||||
[ $$(git ls-remote --tags $(REMOTE) $(TAG) |wc -l) -eq 0 ] \
|
||||
|| $(call exec,$(RUN) git push $(REMOTE) :refs/tags/$(TAG))
|
||||
$(RUN) git push $(REMOTE) refs/remotes/subrepo/$(SUBREPO)/$*:refs/tags/$(TAG)
|
||||
endif
|
||||
|
||||
# target subrepo-push: Push to subrepo
|
||||
@@ -55,7 +55,7 @@ endif
|
||||
# if specific branch name, delete remote branch before push and recreate it from master
|
||||
ifneq ($(findstring $(firstword $(subst /, ,$(BRANCH))),feature hotfix release story),)
|
||||
$(eval IGNORE_DRYRUN := true)
|
||||
$(eval DELETE = $(shell $(call exec,sh -c 'git ls-remote --heads $(REMOTE) $(BRANCH) |wc -l')) )
|
||||
$(eval DELETE = $(shell sh -c 'git ls-remote --heads $(REMOTE) $(BRANCH) |wc -l') )
|
||||
$(eval IGNORE_DRYRUN := false)
|
||||
else
|
||||
$(eval DELETE = 0)
|
||||
@@ -64,12 +64,12 @@ endif
|
||||
$(call INFO,subrepo $(SUBREPO) already up to date); \
|
||||
else \
|
||||
if [ $(DELETE) -eq 1 ]; then \
|
||||
$(call exec,$(RUN) git push $(REMOTE) :$(BRANCH)); \
|
||||
$(call exec,$(RUN) git push $(REMOTE) refs/remotes/$(REMOTE)/master:refs/heads/$(BRANCH)); \
|
||||
$(RUN) git push $(REMOTE) :$(BRANCH); \
|
||||
$(RUN) git push $(REMOTE) refs/remotes/$(REMOTE)/master:refs/heads/$(BRANCH); \
|
||||
fi; \
|
||||
$(call exec,$(RUN) git subrepo fetch $(SUBREPO) -b $(BRANCH)); \
|
||||
$(call exec,$(RUN) git subrepo push $(SUBREPO) -b $(BRANCH) $(UPDATE_SUBREPO_OPTIONS)); \
|
||||
$(call exec,$(RUN) git subrepo clean $(SUBREPO)); \
|
||||
$(RUN) git subrepo fetch $(SUBREPO) -b $(BRANCH); \
|
||||
$(RUN) git subrepo push $(SUBREPO) -b $(BRANCH) $(UPDATE_SUBREPO_OPTIONS); \
|
||||
$(RUN) git subrepo clean $(SUBREPO); \
|
||||
fi
|
||||
|
||||
# target subrepos-branch-delete: Fire APPS target
|
||||
@@ -83,7 +83,7 @@ subrepos-tag-create-%: $(APPS) ;
|
||||
# target subrepos-update: Fire APPS target and push updates to upstream
|
||||
.PHONY: subrepos-update
|
||||
subrepos-update: myos-base git-stash $(APPS) git-unstash ## Update subrepos
|
||||
$(call exec,$(RUN) git push upstream $(BRANCH))
|
||||
$(RUN) git push upstream $(BRANCH)
|
||||
|
||||
# target subrepo-update-%: Call subrepo-update target in folder %
|
||||
.PHONY: subrepo-update-%
|
||||
|
||||
Reference in New Issue
Block a user