Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
4 changes: 2 additions & 2 deletions .github/workflows/d2e-demosetup-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ on:
workflow_dispatch:
inputs:
version:
default: "0.17.0-beta"
default: "0.18.0-beta"
description: Enter version to use
required: true
type: string

env:
DEFAULT_VERSION: "0.17.0-beta"
DEFAULT_VERSION: "0.18.0-beta"

jobs:
demosetup:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Download the updated binary for your operating system and architecture using the
In the d2e directory, open the `.env` file and make these changes:
- Set `DOCKER_TAG_NAME` to the docker image tag for the new version.
- Example: For version `0.12.0`, set `DOCKER_TAG_NAME=0.12.0-beta`. The format is `DOCKER_TAG_NAME=<version>-beta`.
- Add `PLUGINS_SEED_UPDATE=true` to trigger a plugin upgrade on the next startup.
- Additional step for upgrades from versions earlier than v0.18: add `PLUGINS_SEED_UPDATE=true` to trigger a plugin upgrade on the next startup.

- Verify the new version is active:

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ohdsi/d2e",
"version": "0.17.0",
"version": "0.18.0",
"description": "Data2Evidence Installer",
"license": "Apache-2.0",
"homepage": "https://d2e.sg",
Expand Down
46 changes: 33 additions & 13 deletions scripts/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ interface CliOptions {

class D2ECli {
version: string;
LATEST_DOCKER_TAG_NAME: string = "0.17.0-beta"; // Update this as needed
default_version: string = "0.17.0"; // Update this as needed default/base version
LATEST_DOCKER_TAG_NAME: string = "0.18.1-beta"; // Update this as needed
default_version: string = "0.18.0"; // Update this as needed default/base version
CADDY__CONFIG: string;
ENV_TYPE: string;
DOCKER_LOG_LEVEL: string;
Expand Down Expand Up @@ -92,17 +92,8 @@ class D2ECli {
"services",
"atlas-db-init"
);
try {
fs.mkdirSync(atlasDbInitDir, { recursive: true });
} catch (err: any) {
if (err?.code === "EACCES" || err?.code === "EPERM") {
console.warn(
`Warning: could not create ${atlasDbInitDir} (permission denied). ` +
`Skipping atlas-db-init staging; continuing with existing files.`
);
return;
}
throw err;
if (!this.replace_staged_dir(atlasDbInitDir)) {
return;
}
for (const [name, content] of Object.entries(atlasDbInitScripts)) {
this.write_embedded_file(path.join(atlasDbInitDir, name), content);
Expand Down Expand Up @@ -136,6 +127,35 @@ class D2ECli {
this.write_embedded_file(dest, content);
}
}

// Clear the staged directory before rewriting it, so its contents always
// match the embedded set exactly. webapi-init globs whatever it finds
// (`for f in /scripts/*.sql`) instead of reading a manifest, so a script a
// previous CLI version staged and no longer ships would still be executed --
// and under ON_ERROR_STOP=1 one that no longer applies fails the whole init.
// Removing first makes stale scripts impossible rather than something to
// detect after the fact.
//
// Only the directory this CLI authors is removed. compose_dir is the repo
// root when the CLI runs from a checkout, so the `services/` above this holds
// the real service sources and must never be touched.
private replace_staged_dir(dir: string): boolean {
try {
fs.rmSync(dir, { recursive: true, force: true });
fs.mkdirSync(dir, { recursive: true });
return true;
} catch (err: any) {
if (err?.code === "EACCES" || err?.code === "EPERM") {
console.warn(
`Warning: could not replace ${dir} (permission denied). ` +
`It looks owned by another user (e.g. root from a release download). ` +
`Continuing with the existing files.`
);
return false;
}
throw err;
}
}
private write_embedded_file(dest: string, content: string): void {
try {
if (fs.existsSync(dest) && fs.readFileSync(dest, "utf8") === content) {
Expand Down
Loading