mirror of
https://github.com/gsi-upm/senpy
synced 2024-11-22 08:12:27 +00:00
Added push to github
This commit is contained in:
parent
ce83fb3981
commit
7637498517
@ -66,6 +66,14 @@ deploy:
|
|||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
|
push-github:
|
||||||
|
stage: deploy
|
||||||
|
script:
|
||||||
|
- make -e push-github
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
- triggers
|
||||||
|
|
||||||
clean :
|
clean :
|
||||||
stage: clean
|
stage: clean
|
||||||
script:
|
script:
|
||||||
|
16
Makefile
16
Makefile
@ -8,14 +8,18 @@ IMAGENAME=$(REPO)/$(NAME)
|
|||||||
IMAGEWTAG=$(IMAGENAME):$(VERSION)
|
IMAGEWTAG=$(IMAGENAME):$(VERSION)
|
||||||
DEVPORT=5000
|
DEVPORT=5000
|
||||||
action="test-${PYMAIN}"
|
action="test-${PYMAIN}"
|
||||||
|
GITHUB_REPO=git@github.com:gsi-upm/senpy.git
|
||||||
|
|
||||||
KUBE_CA_PEM_FILE=""
|
KUBE_CA_PEM_FILE=""
|
||||||
KUBE_URL=""
|
KUBE_URL=""
|
||||||
KUBE_TOKEN=""
|
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)
|
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=docker.io
|
||||||
CI_REGISTRY_USER=gitlab
|
CI_REGISTRY_USER=gitlab
|
||||||
CI_BUILD_TOKEN=""
|
CI_BUILD_TOKEN=""
|
||||||
|
CI_COMMIT_REF_NAME=master
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
all: build run
|
all: build run
|
||||||
@ -27,7 +31,7 @@ version: .FORCE
|
|||||||
@echo $(VERSION)
|
@echo $(VERSION)
|
||||||
|
|
||||||
yapf:
|
yapf:
|
||||||
yapf -i -r senpy
|
yapf -i -r $(NAME)
|
||||||
yapf -i -r tests
|
yapf -i -r tests
|
||||||
|
|
||||||
init:
|
init:
|
||||||
@ -120,11 +124,19 @@ push: $(addprefix push-,$(PYVERSIONS))
|
|||||||
docker tag '$(IMAGEWTAG)-python$(PYMAIN)' '$(IMAGEWTAG)'
|
docker tag '$(IMAGEWTAG)-python$(PYMAIN)' '$(IMAGEWTAG)'
|
||||||
docker push $(IMAGENAME):$(VERSION)
|
docker push $(IMAGENAME):$(VERSION)
|
||||||
|
|
||||||
|
push-github:
|
||||||
|
$(eval KEY_FILE := $(shell mktemp))
|
||||||
|
@echo "$$GITHUB_DEPLOY_KEY" > $(KEY_FILE)
|
||||||
|
@git remote rm github-deploy || true
|
||||||
|
git remote add github-deploy $(GITHUB_REPO)
|
||||||
|
@GIT_SSH_COMMAND="ssh -i $(KEY_FILE)" git push github-deploy $(CI_COMMIT_REF_NAME)
|
||||||
|
rm $(KEY_FILE)
|
||||||
|
|
||||||
ci:
|
ci:
|
||||||
gitlab-runner exec docker --docker-volumes /var/run/docker.sock:/var/run/docker.sock --env CI_PROJECT_NAME=$(NAME) ${action}
|
gitlab-runner exec docker --docker-volumes /var/run/docker.sock:/var/run/docker.sock --env CI_PROJECT_NAME=$(NAME) ${action}
|
||||||
|
|
||||||
deploy:
|
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) 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/
|
$(KUBECTL) apply -f /tmp/cwd/k8s/
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user