From 23f159118aa61efbafd12a21af91cd866c865c78 Mon Sep 17 00:00:00 2001 From: Christopher Guindon <chris.guindon@eclipse-foundation.org> Date: Tue, 19 Nov 2019 14:57:32 -0500 Subject: [PATCH] Fix log dates and dryrun is now the default The getUTCDay() method returns the day of the week (from 0 to 6) for the specified date, according to universal time. We should use getUTCDate since it returns the day of the month (from 1 to 31) of the date object, according to universal time. Signed-off-by: Christopher Guindon <chris.guindon@eclipse-foundation.org> --- docker-compose.yml | 6 +++--- k8s/cronjob.yml | 2 +- package.json | 2 +- src/Client.js | 2 +- src/Sync.js | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 7870927..af28eb7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,10 +7,10 @@ services: - ./.cache:/app/.cache environment: - VERBOSE_VAL=true + - DRYRUN=true secrets: - api-token - + secrets: api-token: - file: secret - \ No newline at end of file + file: secret \ No newline at end of file diff --git a/k8s/cronjob.yml b/k8s/cronjob.yml index 726790b..08781ad 100644 --- a/k8s/cronjob.yml +++ b/k8s/cronjob.yml @@ -18,7 +18,7 @@ spec: args: - /bin/sh - -c - - npm start -- --verbose=true --dryrun=true | tee -a /app/logs/stdout-$(date +%Y%m%d).log + - npm start -- --verbose=true --dryrun=true | tee -a /app/logs/stdout-$(date +%Y-%m-%d).log volumeMounts: - name: logs mountPath: /app/logs diff --git a/package.json b/package.json index fd40247..bea1a35 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "url": "git+https://github.com/eclipsefdn/eclipsefdn-github-sync.git" }, "author": "Martin Lowe", - "scripts" : { + "scripts": { "start": "node src/Sync.js" }, "license": "EPL-2.0", diff --git a/src/Client.js b/src/Client.js index eebf2e2..449db7e 100644 --- a/src/Client.js +++ b/src/Client.js @@ -16,7 +16,7 @@ const fs = require('fs'); const winston = require('winston'); var now = new Date(); -winston.add(new winston.transports.File({ filename: `logs/cli-${now.getUTCFullYear()}-${now.getUTCMonth()}-${now.getUTCDay()}.log` })); +winston.add(new winston.transports.File({ filename: `logs/cli-${now.getUTCFullYear()}-${now.getUTCMonth()+1}-${now.getUTCDate()}.log` })); winston.add(new winston.transports.Console({ level: 'error' })); // set up yargs command line parsing diff --git a/src/Sync.js b/src/Sync.js index b3b1b31..dc94f9d 100644 --- a/src/Sync.js +++ b/src/Sync.js @@ -50,7 +50,7 @@ winston.configure({ ), transports: [ new winston.transports.File({ - filename: `logs/sync-${now.getUTCFullYear()}-${now.getUTCMonth()}-${now.getUTCDay()}.log`, + filename: `logs/sync-${now.getUTCFullYear()}-${now.getUTCMonth()+1}-${now.getUTCDate()}.log`, level: 'debug' }), new winston.transports.Console({ level: argv.V ? 'debug' : 'error' }) -- GitLab