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

Fix publish issues #5012

Merged
merged 3 commits into from
Jun 12, 2019
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
12 changes: 4 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,7 @@ jobs:

- run:
name: Extract documentation
command: |
mkdir --parent artifacts/documentations/
docker run --rm --name=doc --detach camptocamp/geomapfish-doc tail -f /dev/null
docker cp doc:/doc/_build/html/ artifacts/documentations/
docker stop doc
command: ci/extract-documentation artifacts/documentations/
when: always

- store_artifacts:
Expand Down Expand Up @@ -170,9 +166,6 @@ jobs:
git config user.email "<ci@camptocamp.com>"
git config user.name "CI"
git fetch push
- run:
name: Clean Docker hub tags
command: ci/clean-dockerhub-tags
- deploy: &publish-docker-pip
name: Push to Docker hub and Pypi
command: |
Expand Down Expand Up @@ -203,6 +196,9 @@ jobs:
- run: *python
- checkout
- run: *init-git
- run:
name: Clean Docker hub tags
command: ci/clean-dockerhub-tags
- deploy: *publish-docker-pip
- deploy:
name: Push to Transifex
Expand Down
8 changes: 6 additions & 2 deletions ci/clean-dockerhub-tags
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
import json
import os
import re
import requests
import subprocess

import requests


token = requests.post(
"https://hub.docker.com/v2/users/login/",
Expand Down Expand Up @@ -54,7 +55,7 @@ def clean_images(image, tag_=lambda tag: tag):
print(docker_tags_to_remove)

for tag in docker_tags_to_remove:
requests.delete(
response = requests.delete(
'https://hub.docker.com/v2/repositories/camptocamp/{image}/tags/{tag}/'.format(
image=image,
tag=tag,
Expand All @@ -63,6 +64,9 @@ def clean_images(image, tag_=lambda tag: tag):
"Authorization": "JWT " + token
}
)
if not response.ok:
print(response.text)
exit(2)

for image in ["geomapfish", "geomapfish-build", "geomapfish-scaffolds", "geomapfish-geoportal"]:
clean_images(image)
Expand Down
7 changes: 7 additions & 0 deletions ci/extract-documentation
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash -ex

mkdir --parent ${1}
docker build --tag=camptocamp/geomapfish-doc --build-arg=MAJOR_VERSION=${MAJOR_VERSION} doc
docker run --rm --name=doc --detach camptocamp/geomapfish-doc tail -f /dev/null
docker cp doc:/doc/_build/html/ ${1}/
docker stop doc
7 changes: 1 addition & 6 deletions ci/publish-documentation
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
#!/bin/bash -ex

GIT_REV=$(git log | head --lines=1 | awk '{{print $2}}')

git fetch origin gh-pages:gh-pages
git checkout gh-pages

if [ -e ${MAIN_BRANCH} ]
then
git rm -r --force -- ${MAIN_BRANCH}
fi

mkdir --parent ${MAIN_BRANCH}
docker run --rm --name=doc camptocamp/geomapfish-doc tail -f /vec/null
docker cp doc:_build/html/ ${MAIN_BRANCH}/
docker stop doc
ci/extract-documentation ${MAIN_BRANCH}

git add --all ${MAIN_BRANCH}
git commit --message="Update documentation for the revision ${GIT_REV}" || true
Expand Down