Skip to content

Commit

Permalink
Interrupted upgrade to master
Browse files Browse the repository at this point in the history
  • Loading branch information
Continuous integration committed Sep 30, 2024
1 parent 12a4c3e commit a568f0e
Show file tree
Hide file tree
Showing 23 changed files with 395 additions and 168 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.9 11
67 changes: 67 additions & 0 deletions .upgrade.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
# 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
- action: move
from: geoportal/lingua-server.cfg
to: geoportal/lingva-server.cfg
- action: move
from: geoportal/lingua-client.cfg
to: geoportal/lingva-client.cfg
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
4 changes: 2 additions & 2 deletions CONST_create_template/docker-compose.override.sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ services:
# # Adapt the path for ngeo / gmf contrib to point where you have checkouted the code.
# # volumes:
# # - ./geoportal/${PACKAGE}_geoportal/static-ngeo:/app/${PACKAGE}_geoportal/static-ngeo
# # - ./../ngeo/src:/usr/lib/node_modules/ngeo/src
# # - ./../ngeo/contribs:/usr/lib/node_modules/ngeo/contribs
# # - ./../ngeo/src:/opt/c2cgeoportal/geoportal/node_modules/ngeo/src
# # - ./../ngeo/contribs:/opt/c2cgeoportal/geoportal/node_modules/ngeo/contribs
# volumes_from:
# - config:rw
# extends:
Expand Down
5 changes: 3 additions & 2 deletions CONST_create_template/geoportal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN make build
RUN mv webpack.apps.js webpack.apps.js.tmpl

ENTRYPOINT [ "/usr/bin/eval-templates" ]
CMD [ "webpack-dev-server", "--mode=development", "--debug", "--watch", "--no-inline" ]
CMD [ "webpack", "serve", "--open", "--mode=development", "--watch", "--no-inline" ]

###############################################################################

Expand All @@ -33,7 +33,8 @@ WORKDIR /app
COPY . /app
# Workaround, see:https://github.com/moby/moby/issues/37965
RUN true
COPY --from=builder /usr/lib/node_modules/ngeo/dist/* /etc/static-ngeo/
COPY --from=builder /opt/c2cgeoportal/geoportal/node_modules/ngeo/dist/* /etc/static-ngeo/
RUN rm /etc/static-ngeo/*.html
COPY --from=builder /etc/static-ngeo/* /etc/static-ngeo/
COPY --from=builder /app/alembic.ini /app/alembic.yaml ./
RUN chmod go+w /etc/static-ngeo/
Expand Down
8 changes: 0 additions & 8 deletions CONST_create_template/geoportal/tsconfig.json

This file was deleted.

41 changes: 3 additions & 38 deletions CONST_create_template/geoportal/webpack.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,12 @@ const TerserPlugin = require('terser-webpack-plugin');

const destDir = '/etc/static-ngeo/';

const babelPresets = [
[
require.resolve('@babel/preset-env'),
{
targets: 'defaults, > 0.1% in CH, > 0.1% in FR, Firefox ESR and supports es6-class and not iOS < 10',
modules: false,
loose: true,
},
],
];

module.exports = (env, argv) => {
const library = argv.library ? argv.library : 'geomapfish';
return {
entry: path.resolve(__dirname, 'geomapfish_geoportal/static-ngeo/api/index.js'),
devtool: 'source-map',
mode: 'production',
module: {
rules: [
{
test: /\.js$/,
use: {
loader: 'babel-loader',
options: {
presets: babelPresets,
babelrc: false,
comments: false,
plugins: [
require.resolve('@babel/plugin-proposal-nullish-coalescing-operator'),
require.resolve('@babel/plugin-proposal-optional-chaining'),
],
},
},
},
],
},
output: {
filename: 'api.js',
path: destDir,
Expand All @@ -51,22 +21,17 @@ module.exports = (env, argv) => {
minimizer: [
new TerserPlugin({
parallel: true,
sourceMap: true,
terserOptions: {
compress: false,
},
}),
],
},
resolve: {
modules: [
'/usr/lib/node_modules',
'/usr/lib/node_modules/ol/node_modules',
'/usr/lib/node_modules/proj4/node_modules',
],
modules: ['/opt/c2cgeoportal/geoportal/node_modules'],
alias: {
api: '/usr/lib/node_modules/ngeo/api/src',
ngeo: '/usr/lib/node_modules/ngeo/src',
api: '/opt/c2cgeoportal/geoportal/node_modules/ngeo/distlib/api/src',
ngeo: '/opt/c2cgeoportal/geoportal/node_modules/ngeo/distlib/src',
},
},
resolveLoader: {
Expand Down
34 changes: 4 additions & 30 deletions CONST_create_template/geoportal/webpack.apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,6 @@ for (const filename of ls(
);
}

const babelPresets = [
[
require.resolve('@babel/preset-env'),
{
targets: 'defaults, > 0.1% in CH, > 0.1% in FR, Firefox ESR and supports es6-class and not iOS < 10',
modules: false,
loose: true,
},
],
];

// Transform code to ES2015 and annotate injectable functions with an $inject array.
const projectRule = {
test: /geomapfish_geoportal\/static-ngeo\/js\/.*\.js$/,
use: {
loader: 'babel-loader',
options: {
presets: babelPresets,
babelrc: false,
comments: false,
plugins: [],
},
},
};
const rules = [projectRule];

const noDevServer = process.env['NO_DEV_SERVER'] == 'TRUE';
const devServer = dev && !noDevServer;

Expand All @@ -74,17 +48,17 @@ module.exports = {
hot: true,
},
entry: entry,
module: {
rules,
},
plugins: plugins,
resolve: {
modules: ['/usr/lib/node_modules'],
modules: ['/opt/c2cgeoportal/geoportal/node_modules/'],
alias: {
'geomapfish': path.resolve(
__dirname,
'geomapfish_geoportal/static-ngeo/js'
),
ngeo: '/opt/c2cgeoportal/geoportal/node_modules/ngeo/distlib/src',
gmf: '/opt/c2cgeoportal/geoportal/node_modules/ngeo/distlib/src',
gmfapi: '/opt/c2cgeoportal/geoportal/node_modules/ngeo/distlib/srcapi',
},
},
};
2 changes: 1 addition & 1 deletion CONST_create_template/geoportal/webpack.commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const config = commons({
DllReferencePluginOptions: {
context: '/usr/lib/',
},
browsers: 'defaults, > 0.1% in CH, > 0.1% in FR, Firefox ESR and supports es6-class and not iOS < 10',
noTs: true,
});

module.exports = () => config;
25 changes: 23 additions & 2 deletions CONST_create_template/scripts/db-backup
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ import sys
def main() -> None:
"""Backup the database."""
parser = argparse.ArgumentParser(description="Backup the database.")
parser.add_argument("--verbose", action="store_true", help="Print the command that is executed.")
parser.add_argument(
"--dry-run", action="store_true", help="Only print the command that would be executed."
)
parser.add_argument(
"--env",
default=".env",
Expand Down Expand Up @@ -83,7 +87,20 @@ def main() -> None:
"--dbname={}".format(env["PGDATABASE"]),
*args.arg,
]
print(shlex.join([*command1, *command2_annon, *command3]))
if args.dry_run or args.verbose:
subprocess.run(
[
"docker",
"run",
"--rm",
"camptocamp/postgres:{}".format(env["POSTGRES_TAG"]),
"pg_dump",
"--version",
]
)
print(shlex.join([*command1, *command2_annon, *command3]))
if args.dry_run:
sys.exit(0)
sys.exit(subprocess.run([*command1, *command2, *command3], stdout=file_out).returncode)
else:
command = [
Expand All @@ -97,7 +114,11 @@ def main() -> None:
'pg_dump --format=c --dbname="$PGDATABASE"',
*args.arg,
]
print(shlex.join(command))
if args.dry_run or args.verbose:
subprocess.run(["docker", "compose", "exec", "tools", "pg_dump", "--version"])
print(shlex.join(command))
if args.dry_run:
sys.exit(0)
sys.exit(subprocess.run(command, stdout=file_out).returncode)


Expand Down
25 changes: 23 additions & 2 deletions CONST_create_template/scripts/db-restore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ import sys
def main() -> None:
"""Restore the database backup."""
parser = argparse.ArgumentParser(description="Restore the database backup.")
parser.add_argument("--verbose", action="store_true", help="Print the command that is executed.")
parser.add_argument(
"--dry-run", action="store_true", help="Only print the command that would be executed."
)
parser.add_argument(
"--env",
help="The env file to use to get the connection settings, by default we log in the composition to "
Expand Down Expand Up @@ -89,7 +93,20 @@ def main() -> None:
"--dbname={}".format(env["PGDATABASE"]),
*args.arg,
]
print(shlex.join([*command1, *command2_annon, *command3]))
if args.verbose or args.dry_run:
subprocess.run(
[
"docker",
"run",
"--rm",
"camptocamp/postgres:{}".format(env["POSTGRES_TAG"]),
"pg_restore",
"--version",
]
)
print(shlex.join([*command1, *command2_annon, *command3]))
if args.dry_run:
sys.exit(0)
sys.exit(subprocess.run([*command1, *command2, *command3], stdin=file_in).returncode)
else:
command = [
Expand All @@ -103,7 +120,11 @@ def main() -> None:
"-c",
'pg_restore --dbname="$PGDATABASE" ' + " ".join(args.arg),
]
print(shlex.join(command))
if args.verbose or args.dry_run:
subprocess.run(["docker", "compose", "exec", "tools", "pg_restore", "--version"])
print(shlex.join(command))
if args.dry_run:
sys.exit(0)
sys.exit(subprocess.run(command, stdin=file_in).returncode)


Expand Down
2 changes: 1 addition & 1 deletion CONST_create_template/tests/test_testapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_desktop_alt(url: str) -> None:
assert response.status_code == 200, response.text

assert re.search(
r'<script src="https?://front/static-ngeo-dist/desktop\..*\.js" crossorigin="anonymous"></script>',
r'<script src="https?://front/static-ngeo-dist/desktop-.*\.js" crossorigin="anonymous"></script>',
response.text,
), response.text
assert re.search(r'<html lang="{{mainCtrl.lang}}" ', response.text), response.text
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ acceptance-init: ## Initialize the acceptance tests
docker compose exec -T tools psql --command='CREATE EXTENSION IF NOT EXISTS pg_trgm'
docker compose exec -T tools psql --command='CREATE EXTENSION IF NOT EXISTS hstore'
scripts/db-restore --docker-compose-file=docker-compose.yaml --docker-compose-file=docker-compose-db.yaml \
<<<<<<< ours
--arg=--clean --arg=--if-exists --arg=--verbose --arg=--no-privileges --arg=--no-owner $(DUMP_FILE)
=======
--arg=--clean --arg=--if-exists --arg=--verbose $(DUMP_FILE) || true
>>>>>>> theirs
docker compose --file=docker-compose.yaml --file=docker-compose-db.yaml up -d

.PHONY: acceptance
Expand Down
Loading

0 comments on commit a568f0e

Please sign in to comment.