Skip to content

Commit

Permalink
Interrupted upgrade to 2.8.1.154
Browse files Browse the repository at this point in the history
  • Loading branch information
Continuous integration committed Oct 7, 2024
1 parent 5c662d4 commit d0a3365
Show file tree
Hide file tree
Showing 12 changed files with 243 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .UPGRADE_INSTRUCTIONS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
The `create.diff` file is a recommendation of the changes that you should apply to your project.
You should apply the changes shown in the diff file on `CONST_create_template/<file>` on your project's `<file>`.
Some advice to be more efficient: if the changes on a file concern a file that you never customize, you can simply copy the new file from `CONST_create_template` (`cp CONST_create_template/<file> <file>`).You can furthermore add this file to the `unmanaged_files` section of the `project.yaml` file, to avoid its contents appearing in the diff file for the next upgrade.
Note that you can also apply them using: git apply --3way create.diff
To continue, type:
./upgrade 2.8.1.154 11
61 changes: 61 additions & 0 deletions .upgrade.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
# The list (by include, exclude) of default files that will not be overwritten by the upgrade.
# That that can be extended with managed_files or reduced with unmanaged_files from the
# project.yaml file in the project root directory.
default_project_file:
include:
- geoportal/setup\.py
- geoportal/vars\.yaml
- geoportal/Makefile
- geoportal/geomapfish_geoportal/__init__\.py
- geoportal/geomapfish_geoportal/templates/.*
- geoportal/geomapfish_geoportal/locale/.*
- geoportal/geomapfish_geoportal/static/.*
- geoportal/geomapfish_geoportal/static-ngeo/.*
- print/print-apps/.*
- mapserver/.*
- tilegeneration/config\.yaml\.tmpl
- project\.yaml
- docker-compose\.yaml
- env\.project
- README\.rst
- \.github/workflows/main\.yaml
- \.github/workflows/rebuild\.yaml
exclude:
- mapserver/demo\.map\.tmpl
- geoportal/geomapfish_geoportal/static-ngeo/js/apps/image/favicon\.ico

# Files ignored when creating the diff files => will just be left untouched.
no_diff:
- .*\.po
- CONST_.+
- .*/CONST_.+

# Files that will be present in the CONST_create_template but will not be considered in the upgrade.
# Used to provide the alt applications => does not disturb the user during upgrade.
extra:
- geoportal/geomapfish_geoportal/static-ngeo/js/apps/mobile_alt\.html\.ejs
- geoportal/geomapfish_geoportal/static-ngeo/js/apps/oeedit\.html\.ejs
- geoportal/geomapfish_geoportal/static-ngeo/js/apps/Controllermobile_alt\.js
- geoportal/geomapfish_geoportal/static-ngeo/js/apps/Controlleroeedit\.js
- geoportal/geomapfish_geoportal/static-ngeo/js/apps/sass/mobile_alt\.scss
- geoportal/geomapfish_geoportal/static-ngeo/js/apps/sass/vars_mobile_alt\.scss
- geoportal/geomapfish_geoportal/static-ngeo/js/apps/sass/oeedit\.scss
- geoportal/geomapfish_geoportal/static-ngeo/js/apps/sass/vars_oeedit\.scss
- geoportal/interfaces/desktop_alt\.html\.mako
- geoportal/geomapfish_geoportal/static/images/background-layer-button\.png
- tests/test_testapp.py

# Automated file system operations:
# Remove some files or directories:
# - action: remove
# paths:
# - <one file or directory>
# Move a file:
# - action: move
# from: <src file>
# to: <dst file>
upgrade_files:
- action: remove
paths:
- geoportal/tools/extract-messages.js
2 changes: 1 addition & 1 deletion CONST_create_template/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ acceptance-init: ## Initialize the acceptance tests
docker-compose exec -T tools wait-db
docker-compose exec -T tools psql --command="DROP EXTENSION IF EXISTS postgis CASCADE"
scripts/db-restore --docker-compose-file=docker-compose.yaml --docker-compose-file=docker-compose-db.yaml \
--arg=--clean --arg=--if-exists --arg=--verbose $(DUMP_FILE)
--arg=--clean --arg=--if-exists --arg=--verbose $(DUMP_FILE) || true
docker-compose --file=docker-compose.yaml --file=docker-compose-db.yaml up -d

.PHONY: acceptance
Expand Down
2 changes: 1 addition & 1 deletion CONST_create_template/ci/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c2cciutils[checks,publish]==1.4.20
c2cciutils[checks,publish]==1.4.21
2 changes: 1 addition & 1 deletion CONST_create_template/env.default
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Default values for c2cgeoportal
GEOMAPFISH_VERSION=2.8.1.151
GEOMAPFISH_VERSION=2.8.1.154
GEOMAPFISH_MAIN_VERSION=2.8
GEOMAPFISH_MAIN_MINOR_VERSION=2.8.1
COMPOSE_PROJECT_NAME=geomapfish
Expand Down
2 changes: 1 addition & 1 deletion CONST_create_template/geoportal/webpack.apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ for (const filename of ls(path.resolve(__dirname, 'geomapfish_geoportal/static-n
chunks: [name],
vars: {
entry_point: '${VISIBLE_ENTRY_POINT}',
version: '2.8.1.151',
version: '2.8.1.154',
cache_version: '${CACHE_VERSION}',
},
})
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ secrets: ## Decrypt the secrets.tar.bz2.gpg file

.PHONY: acceptance-init
acceptance-init: ## Initialize the acceptance tests
<<<<<<< ours
cat env.acceptance-test >> .env
docker volume rm demo_postgresql_data || true
docker compose --file=docker-compose.yaml --file=docker-compose-db.yaml up -d db tools
Expand All @@ -71,6 +72,14 @@ acceptance-init: ## Initialize the acceptance tests
scripts/db-restore --docker-compose-version-2 --docker-compose-file=docker-compose.yaml --docker-compose-file=docker-compose-db.yaml \
--arg=--clean --arg=--if-exists --arg=--verbose --arg=--no-privileges --arg=--no-owner $(DUMP_FILE)
docker compose --file=docker-compose.yaml --file=docker-compose-db.yaml up -d
=======
docker-compose --file=docker-compose.yaml --file=docker-compose-db.yaml up -d db tools
docker-compose exec -T tools wait-db
docker-compose exec -T tools psql --command="DROP EXTENSION IF EXISTS postgis CASCADE"
scripts/db-restore --docker-compose-file=docker-compose.yaml --docker-compose-file=docker-compose-db.yaml \
--arg=--clean --arg=--if-exists --arg=--verbose $(DUMP_FILE) || true
docker-compose --file=docker-compose.yaml --file=docker-compose-db.yaml up -d
>>>>>>> theirs

.PHONY: acceptance
acceptance: ## Run the acceptance tests
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c2cciutils[checks,publish]==1.4.20
c2cciutils[checks,publish]==1.4.21
13 changes: 13 additions & 0 deletions create.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/Makefile b/Makefile
index ae6d8ca..bfdcbb7 100644
--- a/Makefile
+++ b/Makefile
@@ -61,7 +61,7 @@ acceptance-init: ## Initialize the acceptance tests
docker-compose exec -T tools wait-db
docker-compose exec -T tools psql --command="DROP EXTENSION IF EXISTS postgis CASCADE"
scripts/db-restore --docker-compose-file=docker-compose.yaml --docker-compose-file=docker-compose-db.yaml \
- --arg=--clean --arg=--if-exists --arg=--verbose $(DUMP_FILE)
+ --arg=--clean --arg=--if-exists --arg=--verbose $(DUMP_FILE) || true
docker-compose --file=docker-compose.yaml --file=docker-compose-db.yaml up -d

.PHONY: acceptance
2 changes: 1 addition & 1 deletion env.default
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Default values for c2cgeoportal
GEOMAPFISH_VERSION=2.8.1.151
GEOMAPFISH_VERSION=2.8.1.154
GEOMAPFISH_MAIN_VERSION=2.8
GEOMAPFISH_MAIN_MINOR_VERSION=2.8.1
COMPOSE_PROJECT_NAME=geomapfish
Expand Down
2 changes: 1 addition & 1 deletion geoportal/webpack.apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ for (const filename of ls(path.resolve(__dirname, 'geomapfish_geoportal/static-n
chunks: [name],
vars: {
entry_point: '${VISIBLE_ENTRY_POINT}',
version: '2.8.1.151',
version: '2.8.1.154',
cache_version: '${CACHE_VERSION}',
},
})
Expand Down
147 changes: 147 additions & 0 deletions upgrade
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
#!/usr/bin/env python3

# Copyright (c) 2019-2024, Camptocamp SA
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:

# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.

# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# The views and conclusions contained in the software and documentation are those
# of the authors and should not be interpreted as representing official policies,
# either expressed or implied, of the FreeBSD Project.


import argparse
import os
import platform
import re
import subprocess
import sys

parser = argparse.ArgumentParser(description="Upgrade the project")
parser.add_argument(
"--debug", help="Path to c2cgeoportal source folder to be able to debug the upgrade procedure"
)
parser.add_argument("version", help="the version to upgrade to (master or x.y.z)")
parser.add_argument("step", nargs="?", help="the step to run")
parser_finalize = argparse.ArgumentParser(description="Upgrade the project", add_help=False)
parser_finalize.add_argument("--finalize", action="store_true", help="finalize the upgrade")
parser_finalize.add_argument("--help", action="help", help="show this help message and exit")
parser_finalize.add_argument(
"--docker-compose-version-2", action="store_true", help="Use Docker Compose version 2"
)
parser_finalize.add_argument("build_arg", nargs="*", help="build arguments")

if len(sys.argv) >= 2 and sys.argv[1] == "--finalize":
args = parser_finalize.parse_args()

if platform.system() == "Windows":
code = subprocess.call(["python", "build"] + args.build_arg)
else:
code = subprocess.call(["./build"] + args.build_arg)
if code != 0:
sys.exit(code)

docker_compose = ["docker", "compose"] if args.docker_compose_version_2 else ["docker-compose"]
subprocess.call([*docker_compose, "down", "--remove-orphans"])
subprocess.call(
[*docker_compose, "pull", "--ignore-pull-failures"], env={**os.environ, "DOCKER_TAG": "unexisting"}
)
subprocess.check_call([*docker_compose, "up", "-d"])
subprocess.check_call(
[
*docker_compose,
"exec",
"geoportal",
"alembic",
"--name=main",
"--config=alembic.ini",
"upgrade",
"head",
]
)

else:
args = parser.parse_args()

c2cupgrade_args = ["--step", args.step] if args.step is not None else []

if os.environ.get("CI") != "true" and args.step is None:
major_version = args.version
match = re.match(r"^([0-9]+\.[0-9]+)\.[0-9]+$", args.version)
if match is not None:
major_version = match.group(1)
match = re.match(r"^([0-9]+\.[0-9]+)\.[0-9a-z]+\.[0-9]+$", args.version)
if match is not None:
major_version = match.group(1)
if not args.debug:
subprocess.check_call(
[
"docker",
"pull",
"camptocamp/geomapfish:{major_version}".format(major_version=major_version),
]
)
subprocess.check_call(
["docker", "pull", "camptocamp/geomapfish-tools:{version}".format(version=args.version)]
)
subprocess.check_call(
[
"docker",
"pull",
"camptocamp/geomapfish-config:{major_version}".format(major_version=major_version),
]
)

debug_volumes = (
[
"--volume={debug}/geoportal/c2cgeoportal_geoportal/scripts/c2cupgrade.py:".format(
debug=args.debug
),
"/opt/c2cgeoportal/geoportal/c2cgeoportal_geoportal/scripts/c2cupgrade.py",
]
if args.debug
else []
)

win = platform.system() == "Windows"
sys.exit(
subprocess.call(
[
"docker",
"run",
"--rm",
"--env=CI",
"--volume={}:/src".format(os.getcwd()),
]
+ debug_volumes
+ [
"camptocamp/geomapfish-tools:{version}".format(version=args.version),
"run-git",
subprocess.check_output(["git", "config", "--get", "user.name"]).decode().strip(),
subprocess.check_output(["git", "config", "--get", "user.email"]).decode().strip(),
"" if win else subprocess.check_output(["id", "-u"]).decode().strip(),
"" if win else subprocess.check_output(["id", "-g"]).decode().strip(),
"/src",
"c2cupgrade",
]
+ c2cupgrade_args
)
)

0 comments on commit d0a3365

Please sign in to comment.