Skip to content

Commit

Permalink
feat(data): load remote data from versioned urls (#287)
Browse files Browse the repository at this point in the history
* feat(data): load remote data from versioned urls

* chore(license): change license to MIT

* chore(versioning): add storage version increase script
  • Loading branch information
pwambach authored Mar 10, 2020
1 parent 2831e00 commit b3a4b39
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 14 deletions.
16 changes: 16 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# The MIT License (MIT)

_Copyright © 2020 Ubilabs GmbH_

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@ npm run electron:build

The final output will be in a folder called `dist-electron` in the project's root directory.

### Release New Version

Run the following command to create a new tagged release.

```sh
npm version <major|minor|patch|prerelease --preid=rc>
```

A new git branch `chore/release-${VERSION}` will be pushed.
In addition all remote files on cloud storage have to be updated to the new version folder. Run the follwing command with the correct version numbers:

```sh
./increase-storage-version <old_version> <new_version> # e.g. increase-storage-version 0.9.3 1.0.0
```

## Contact

- PM Ubilabs: Patrick Mast <mast@ubilabs.net>
Expand Down
10 changes: 0 additions & 10 deletions ci/cloudbuild-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@ steps:
args: ['run', 'build']
- name: 'gcr.io/cloud-builders/gsutil'
args: ['rsync', '-r', '-d', './dist', 'gs://esa-cfs-versions/web/${BRANCH_NAME}']
- name: 'gcr.io/cloud-builders/gsutil'
args:
[
'acl',
'ch',
'-r',
'-u',
'AllUsers:R',
'gs://esa-cfs-versions/web/${BRANCH_NAME}/*',
]
- name: 'gcr.io/cloud-builders/gsutil'
args:
[
Expand Down
4 changes: 2 additions & 2 deletions ci/cloudbuild-tiles.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# manually run with "gcloud builds submit --config ./ci/cloudbuild-tiles.yaml --timeout=2000 --substitutions _LAYER_ID="fire.burned_area",_VARIABLE_ID="burned_area",_DATASET_ID="esacci.FIRE.mon.L4.BA.MODIS.Terra.MODIS_TERRA.v5-1.r1",_TIME_RANGE="2010-01-01.2011-01-01",_TILE_SIZE=256 ."
# manually run with "gcloud builds submit --config ./ci/cloudbuild-tiles.yaml --timeout=2000 --substitutions _LAYER_ID="fire.burned_area",_VARIABLE_ID="burned_area",_DATASET_ID="esacci.FIRE.mon.L4.BA.MODIS.Terra.MODIS_TERRA.v5-1.r1",_TIME_RANGE="2010-01-01.2011-01-01",_TILE_SIZE=256,_VERSION=0.0.1 ."
# or locally with "cloud-build-local --dryrun=false --config ./ci/cloudbuild-tiles.yaml --substitutions [copy-from-above] ."
steps:
# export zarr file with cate
Expand Down Expand Up @@ -39,5 +39,5 @@ steps:
- "cp"
- "-r"
- "./upload/${_LAYER_ID}/*"
- "gs://esa-cfs-tiles/generated/${_LAYER_ID}/"
- "gs://esa-cfs-tiles/${_VERSION}/${_LAYER_ID}/"
timeout: 2000s
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
"electron:install": "electron-builder install-app-deps",
"electron:clean": "rm -rf ./dist-electron",
"electron:build": "npm run electron:clean && npm run electron:install && npm run build:electron && electron-builder -mwl --x64 --config electron-builder.json",
"upload-storage": "gsutil rsync -r -x \".DS_Store\" ./storage gs://esa-cfs-storage && gsutil setmeta -h \"Cache-Control: no-cache\" gs://esa-cfs-storage/**/*"
"upload-storage": "gsutil rsync -r -x \".DS_Store\" ./storage gs://esa-cfs-storage/$npm_package_version && gsutil -m setmeta -r -h \"Cache-Control: no-cache\" gs://esa-cfs-storage/$npm_package_version/"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ubilabs/esa-climate-from-space.git"
},
"author": "Ubilabs GmbH",
"license": "ISC",
"license": "MIT",
"bugs": {
"url": "https://github.com/ubilabs/esa-climate-from-space/issues"
},
Expand Down
14 changes: 14 additions & 0 deletions scripts/increase-storage-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
# Description: Copy remote files to new version directory.
# This script should be executed every time a new version is created.
# Usage: ./increase-storage-version <old_version> <new_version>
old=$1
new=$2

if [ $# -ne 2 ]
then
echo "Error: You have to specify a old and new version number (e.g. increase-storage-version 0.9.3 1.0.0)"
fi

gsutil -m cp -r gs://esa-cfs-storage/$old/* gs://esa-cfs-storage/$new/
gsutil -m cp -r gs://esa-cfs-tiles/$old/* gs://esa-cfs-tiles/$new/

0 comments on commit b3a4b39

Please sign in to comment.