Skip to content

Commit

Permalink
migrate to js action
Browse files Browse the repository at this point in the history
  • Loading branch information
GregoireW committed Oct 15, 2024
1 parent 728593b commit 6c4afe6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
12 changes: 5 additions & 7 deletions dblinter-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,9 @@ async function launchPostgres(config) {

console.log("------------ pg container ------------");
const container=await docker.dockerCommand(`run -d -e POSTGRES_PASSWORD=${pgPass} postgres:${config.postgresVersion}`);
console.log("------------ /container ------------");
console.log("------------ /pg container ------------");
const inspect= await docker.dockerCommand(`inspect ${container.containerId} -f '{"ip":"{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}"}'`, {echo: false});
console.log("------------ inspect ------------");
console.log(inspect.object.ip);
console.log("------------ /inspect ------------");

// -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}'
console.log(`postgres is bound on ip: ${inspect.object.ip}`);

return {
pgContainer: container.containerId,
Expand All @@ -166,13 +162,15 @@ async function launchPostgres(config) {

async function executeFlyway(config, postgres) {
if (!config.flywayMigration) {
console.log("No flyway migration file found");
return;
}
await docker.dockerCommand(`run --rm -v ${config.flywayMigration}:/flyway/sql flyway/flyway:${config.flywayVersion} -locations="filesystem:/flyway/sql" -url=jdbc:postgresql://${postgres.pgHost}:${postgres.pgPort}/${postgres.pgDatabase} -user=${postgres.pgUser} -password=${postgres.pgPass} migrate`, {stdio: 'inherit'});
await docker.dockerCommand(`run --rm -v ${config.flywayMigration}:/flyway/sql flyway/flyway:${config.flywayVersion} -locations="filesystem:/flyway/sql" -url=jdbc:postgresql://${postgres.pgHost}:${postgres.pgPort}/${postgres.pgDatabase} -user=${postgres.pgUser} -password=${postgres.pgPass} migrate`);
}

async function executeInitSql(config, postgres){
if (!config.initScript) {
console.log("No init script found");
return;
}

Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

0 comments on commit 6c4afe6

Please sign in to comment.