Skip to content

Commit

Permalink
Added push to github
Browse files Browse the repository at this point in the history
  • Loading branch information
balkian committed May 19, 2017
1 parent ce83fb3 commit 1e96b80
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ deploy:
only:
- master

push-github:
stage: deploy
script:
- make -e push-github
only:
- master
- triggers

clean :
stage: clean
script:
Expand Down
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@ IMAGENAME=$(REPO)/$(NAME)
IMAGEWTAG=$(IMAGENAME):$(VERSION)
DEVPORT=5000
action="test-${PYMAIN}"
GITHUB_REPO[email protected]:gsi-upm/senpy.git

KUBE_CA_PEM_FILE=""
KUBE_URL=""
KUBE_TOKEN=""
KUBE_NS=$(NAME)
KUBECTL=docker run --rm -v $(KUBE_CA_PEM_FILE):/tmp/ca.pem -v $$PWD:/tmp/cwd/ -i lachlanevenson/k8s-kubectl --server="$(KUBE_URL)" --token="$(KUBE_TOKEN)" --certificate-authority="/tmp/ca.pem" -n $(KUBE_NAMESPACE)
CI_REGISTRY=docker.io
CI_REGISTRY_USER=gitlab
CI_BUILD_TOKEN=""



all: build run

.FORCE:
Expand All @@ -27,7 +30,7 @@ version: .FORCE
@echo $(VERSION)

yapf:
yapf -i -r senpy
yapf -i -r $(NAME)
yapf -i -r tests

init:
Expand Down Expand Up @@ -120,11 +123,18 @@ push: $(addprefix push-,$(PYVERSIONS))
docker tag '$(IMAGEWTAG)-python$(PYMAIN)' '$(IMAGEWTAG)'
docker push $(IMAGENAME):$(VERSION)

push-github:
$(eval KEY_FILE := $(shell mktemp))
@echo "$$GITHUB_DEPLOY_KEY" > $(KEY_FILE)
@git remote rm github-deploy
git remote add github-deploy $(GITHUB_REPO)
@GIT_SSH_COMMAND="ssh -i $(KEY_FILE)" git push github-deploy master

ci:
gitlab-runner exec docker --docker-volumes /var/run/docker.sock:/var/run/docker.sock --env CI_PROJECT_NAME=$(NAME) ${action}

deploy:
$(KUBECTL) delete -n senpy secret $(CI_REGISTRY) || true
$(KUBECTL) delete -n $(KUBE_NS) secret $(CI_REGISTRY) || true
@$(KUBECTL) create -n $(NAME) secret docker-registry $(CI_REGISTRY) --docker-server=$(CI_REGISTRY) --docker-username=$(CI_REGISTRY_USER) --docker-email=$(CI_REGISTRY_USER) --docker-password=$(CI_BUILD_TOKEN)
$(KUBECTL) apply -f /tmp/cwd/k8s/

Expand Down

0 comments on commit 1e96b80

Please sign in to comment.