Commit e31bca70 authored by J. Fernando Sánchez's avatar J. Fernando Sánchez
Browse files

Push to dockerhub instead of private registry

parent 7956d54c
...@@ -15,7 +15,7 @@ stages: ...@@ -15,7 +15,7 @@ stages:
- clean - clean
before_script: before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY - docker login -u $HUB_USER -p $HUB_PASSWORD
.test: &test_definition .test: &test_definition
stage: test stage: test
...@@ -58,24 +58,44 @@ push-latest: ...@@ -58,24 +58,44 @@ push-latest:
- master - master
- triggers - triggers
deploy: push-github:
stage: deploy stage: deploy
environment: test
script: script:
- make -e deploy - make -e push-github
only: only:
- master - master
- triggers
push-github: deploy_pypi:
stage: deploy
script: # Configure the PyPI credentials, then push the package, and cleanup the creds.
- echo "[server-login]" >> ~/.pypirc
- echo "username=" ${PYPI_USER} >> ~/.pypirc
- echo "password=" ${PYPI_PASSWORD} >> ~/.pypirc
- make pip_upload
- echo "" > ~/.pypirc && rm ~/.pypirc # If the above fails, this won't run.
only:
- /^v\d+\.\d+\.\d+([abc]\d*)?$/ # PEP-440 compliant version (tags)
except:
- branches
deploy:
stage: deploy stage: deploy
environment: test
script: script:
- make -e push-github - make -e deploy
only: only:
- master - master
- triggers
clean : clean_docker :
stage: clean stage: clean
script: script:
- make -e clean - make -e clean
when: manual when: manual
cleanup_pypirc:
stage: clean
when: always # this is important; run even if preceding stages failed.
script:
- rm -vf ~/.pypirc # we don't want to leave these around, but GitLab may clean up anyway.
- docker logout
\ No newline at end of file
PYVERSIONS=3.5 2.7
PYMAIN=$(firstword $(PYVERSIONS))
NAME=senpy NAME=senpy
REPO=gsiupm
VERSION=$(shell git describe --tags --dirty 2>/dev/null) VERSION=$(shell git describe --tags --dirty 2>/dev/null)
TARNAME=$(NAME)-$(VERSION).tar.gz GITHUB_REPO=git@github.com:gsi-upm/senpy.git
IMAGENAME=$(REPO)/$(NAME)
IMAGENAME=gsiupm/senpy
IMAGEWTAG=$(IMAGENAME):$(VERSION) IMAGEWTAG=$(IMAGENAME):$(VERSION)
PYVERSIONS=3.5 2.7
PYMAIN=$(firstword $(PYVERSIONS))
DEVPORT=5000 DEVPORT=5000
TARNAME=$(NAME)-$(VERSION).tar.gz
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=""
...@@ -83,6 +86,9 @@ pip_test-%: sdist ...@@ -83,6 +86,9 @@ pip_test-%: sdist
pip_test: $(addprefix pip_test-,$(PYVERSIONS)) pip_test: $(addprefix pip_test-,$(PYVERSIONS))
pip_upload: pip_test
python setup.py sdist upload ;
clean: clean:
@docker ps -a | grep $(IMAGENAME) | awk '{ split($$2, vers, "-"); if(vers[0] != "${VERSION}"){ print $$1;}}' | xargs docker rm -v 2>/dev/null|| true @docker ps -a | grep $(IMAGENAME) | awk '{ split($$2, vers, "-"); if(vers[0] != "${VERSION}"){ print $$1;}}' | xargs docker rm -v 2>/dev/null|| true
@docker images | grep $(IMAGENAME) | awk '{ split($$2, vers, "-"); if(vers[0] != "${VERSION}"){ print $$1":"$$2;}}' | xargs docker rmi 2>/dev/null|| true @docker images | grep $(IMAGENAME) | awk '{ split($$2, vers, "-"); if(vers[0] != "${VERSION}"){ print $$1":"$$2;}}' | xargs docker rmi 2>/dev/null|| true
...@@ -98,9 +104,6 @@ git_tag: ...@@ -98,9 +104,6 @@ git_tag:
git_push: git_push:
git push --tags origin master git push --tags origin master
pip_upload: pip_test
python setup.py sdist upload ;
run-%: build-% run-%: build-%
docker run --rm -p $(DEVPORT):5000 -ti '$(IMAGEWTAG)-python$(PYMAIN)' --default-plugins docker run --rm -p $(DEVPORT):5000 -ti '$(IMAGEWTAG)-python$(PYMAIN)' --default-plugins
...@@ -141,5 +144,4 @@ deploy: ...@@ -141,5 +144,4 @@ deploy:
@$(KUBECTL) apply -f /tmp/cwd/k8s/ @$(KUBECTL) apply -f /tmp/cwd/k8s/
.PHONY: test test-% test-all build-% build test pip_test run yapf push-main push-% dev ci version .FORCE deploy .PHONY: test test-% test-all build-% build test pip_test run yapf push-main push-% dev ci version .FORCE deploy
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment