aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Harvey <andrew@alantgeo.com.au>2021-05-27 15:59:07 +1000
committerAndrew Harvey <andrew@alantgeo.com.au>2021-05-27 15:59:07 +1000
commitdd0a8fe143b5c778c17c92496de513ae066dc04f (patch)
treef31e5d0f97de40dae96d97b4439778a7070a0ef4
parent6fc8dc4617916d57427a85478b4448e0684e3798 (diff)
test upload to API dev server
-rw-r--r--.gitlab-ci.yml21
-rwxr-xr-xbin/upload.sh45
2 files changed, 65 insertions, 1 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b528229..1663c93 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -16,6 +16,8 @@ stages:
- prepare
- build
- conflate
+ - candidate
+ - upload
docker prepare:
image: docker:latest
@@ -188,13 +190,30 @@ candidate:
- yarn install
- cp src/polygon-lookup-patch.js node_modules/polygon-lookup/index.js
- make dist/candidate
- - make testUploadCandidates
when: manual
artifacts:
name: "candidate"
paths:
- dist
+upload dev:
+ stage: upload
+ image: "registry.gitlab.com/alantgeo/vicmap2osm:candidate"
+ before_script:
+ - ls data dist
+ cache:
+ <<: *global_cache
+ policy: pull
+ script:
+ - yarn install
+ - cp src/polygon-lookup-patch.js node_modules/polygon-lookup/index.js
+ - ./bin/upload.sh
+ when: manual
+ artifacts:
+ name: "upload"
+ paths:
+ - uploadLog
+
build compareSuburb:
stage: build
image: "registry.gitlab.com/alantgeo/vicmap2osm:build-osm"
diff --git a/bin/upload.sh b/bin/upload.sh
new file mode 100755
index 0000000..2971026
--- /dev/null
+++ b/bin/upload.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+set -e
+
+mkdir -p uploadLog
+
+IMPORT_DOC="https://wiki.openstreetmap.org/wiki/Imports/Vicmap_Address"
+
+i=0
+totalFiles=`ls -1 dist/candidates/newAddressWithoutConflicts/*.osm | wc -l`
+for f in dist/candidates/newAddressWithoutConflicts/*.osm; do
+ i=$(($i + 1))
+
+ layerMessage="adding new addresses not found in OSM"
+ d=`dirname "$f"`
+ b=`basename "$f" .osm`
+ id=`echo "$b" | cut -d'_' -f1`
+ name=`echo "$b" | cut -d'_' -f2`
+
+ echo "$i/$totalFiles $id: $name"
+
+ echo " to osc"
+ ./upload/osm2change.py "$f"
+
+ if [ ! -e "$d/$b.osc" ] ; then
+ echo "$d/$b.osc not found"
+ echo '$f' >> uploadLog/oscNotFound.txt
+ else
+ echo " upload"
+ ./upload/upload.py \
+ -u 'vicmap_import' \
+ -p "${OSM_DEV_PASSWORD}" \
+ -c yes \
+ -m "Vicmap Import $layerMessage: $name. See $IMPORT_DOC" \
+ -y 'Vicmap Address' \
+ "$d/$b.osc"
+ echo "$f" >> uploadLog/uploaded.txt
+ fi
+
+ # give the api a rest
+ sleep 1s
+
+ # stop after first, used during testing
+ exit
+done