Skip to content

Commit

Permalink
Move to Vite and update packages (#183)
Browse files Browse the repository at this point in the history
* migrated to vite
* move from moment to dayjs
* update cron
* Update node version to v18.16.0
* update cronstrue
* Update build action versions
* Eliminate old debug script
* Split backend from client
* New npm run start command to bring client up for debugging
* Update version and changelog
  • Loading branch information
chriskinsman authored May 19, 2023
1 parent 484e5a9 commit ab02a35
Show file tree
Hide file tree
Showing 25 changed files with 8,866 additions and 27,384 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses:
actions/checkout@v2
actions/checkout@v3
# this is required to run npm install from our other private github repo
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
cache: "npm"
cache-dependency-path: "web/client/package-lock.json"
Expand Down Expand Up @@ -61,23 +61,23 @@ jobs:
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
echo ::set-output name=platforms::${PLATFORMS}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Built platforms
run: echo ${{ steps.prep.outputs.platforms }}
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_CR_PAT }}
- name: Cache Docker layers
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx2-refs/heads/${{ github.ref }}
Expand All @@ -87,7 +87,7 @@ jobs:
${{ runner.os }}-buildx2-
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.13.1
v18.16.0
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Changed

## [4.0.13] - 2023-05-18
### Changed
- Moved from vue-cli to Vite
- Moved from momentjs to dayjs
- Updated to node v18.16.0
- Updated construe and cron
- Updated GitHub Action versions
- Split backend from client
- New npm run start command to bring client up for debugging


## [4.0.12] - 2023-05-15
### Changed
- Removed the timestamp prefix from the collected logs on containerd to match docker behavior
Expand Down
7 changes: 5 additions & 2 deletions bin/tilloo-cli-listjobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
'use strict';

const Table = require('easy-table');
const moment = require('moment');
const dayjs = require('dayjs');
const localizedFormat = require('dayjs/plugin/localizedFormat');

dayjs.extend(localizedFormat);

const Job = require('../models/job');

Expand All @@ -16,7 +19,7 @@ const Job = require('../models/job');
table.cell('Schedule', job.schedule);
table.cell('Enabled', job.enabled);
table.cell('Node Selector', job.nodeSelector);
table.cell('Last Ran', job.lastRanAt ? moment(job.lastRanAt).format('l LTS') : '');
table.cell('Last Ran', job.lastRanAt ? dayjs(job.lastRanAt).format('l LTS') : '');
table.cell('Last Status', job.lastStatus);
table.newRow();
});
Expand Down
9 changes: 6 additions & 3 deletions bin/tilloo-cli-listruns.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@

const commander = require('commander');
const Table = require('easy-table');
const moment = require('moment');
const dayjs = require('dayjs');
const localizedFormat = require('dayjs/plugin/localizedFormat');

dayjs.extend(localizedFormat);

const Run = require('../models/run');

Expand All @@ -25,8 +28,8 @@ if (commander.args.length !== 1) {
table.cell('Worker', run.worker);
table.cell('Pod', run.pod);
table.cell('Result', run.result);
table.cell('Started', moment(run.startedAt).format('l LTS'));
table.cell('Completed', moment(run.completedAt).format('l LTS'));
table.cell('Started', dayjs(run.startedAt).format('l LTS'));
table.cell('Completed', dayjs(run.completedAt).format('l LTS'));
table.cell('Status', run.status);
table.newRow();
});
Expand Down
7 changes: 0 additions & 7 deletions debugcluster.sh

This file was deleted.

3 changes: 1 addition & 2 deletions lib/k8s/zombieruns.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const constants = require('../constants');
const async = require('async');
const debug = require('debug')('tilloo:k8s/zombieruns');
const rabbit = require('../rabbitfactory');
const moment = require('moment');

const config = require('../config');
const Job = require('../../models/job');
Expand Down Expand Up @@ -52,7 +51,7 @@ module.exports.start = function start() {
await updateStatus({ status: constants.JOBSTATUS.SUCCESS, runId: job.metadata.labels.runId, jobId: job.metadata.labels.jobId });
zombieRun.status = constants.JOBSTATUS.SUCCESS;
}
else if (!job.status.active && moment().subtract(5, 'minutes').isAfter(zombieRun.createdAt)) {
else if (!job.status.active && dayjs().subtract(5, 'minutes').isAfter(zombieRun.createdAt)) {
debug(`Job not found updating status to fail runId: ${job.metadata.labels.runId}`);
await updateStatus({ status: constants.JOBSTATUS.FAIL, runId: job.metadata.labels.runId, jobId: job.metadata.labels.jobId });
zombieRun.status = constants.JOBSTATUS.FAIL;
Expand Down
10 changes: 5 additions & 5 deletions lib/notifications.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const moment = require('moment');
const dayjs = require('dayjs');
const config = require('./config');
const constants = require('./constants');
const Job = require('../models/job');
Expand Down Expand Up @@ -55,23 +55,23 @@ exports.notify = async function notify(message) {
}

if (jobsInError[jobId]) {
const statusTime = moment(jobsInError[jobId].lastErrorTime);
const statusTime = dayjs(jobsInError[jobId].lastErrorTime);

if (message.status === constants.JOBSTATUS.SUCCESS) {
if (jobsInError[jobId].alertSent) {
broadcastNotification(message, jobsInError[jobId].lastErrorTime, jobsInError[jobId].errorCount, job);
}
delete jobsInError[jobId];
}
else if (message.status === constants.JOBSTATUS.FAIL && ++jobsInError[jobId].errorCount >= failuresBeforeAlert && (moment().diff(statusTime, 'seconds') > config.notification.threshold || !jobsInError[jobId].alertSent)) {
else if (message.status === constants.JOBSTATUS.FAIL && ++jobsInError[jobId].errorCount >= failuresBeforeAlert && (dayjs().diff(statusTime, 'seconds') > config.notification.threshold || !jobsInError[jobId].alertSent)) {
// update to reset threshold
jobsInError[jobId].lastErrorTime = moment().toDate();
jobsInError[jobId].lastErrorTime = dayjs().toDate();
jobsInError[jobId].alertSent = true;
broadcastNotification(message, jobsInError[jobId].lastErrorTime, jobsInError[jobId].errorCount, job);
}
}
else if (message.status === constants.JOBSTATUS.FAIL) {
jobsInError[jobId] = { lastErrorTime: moment().toDate(), errorCount: 1, alertSent: false };
jobsInError[jobId] = { lastErrorTime: dayjs().toDate(), errorCount: 1, alertSent: false };
if (failuresBeforeAlert === 1) {
broadcastNotification(message, jobsInError[jobId].lastErrorTime, jobsInError[jobId].errorCount, job);
jobsInError[jobId].alertSent = true;
Expand Down
3 changes: 1 addition & 2 deletions models/run.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const constants = require('../lib/constants');

const moment = require('moment');
const mongoose = require('../lib/mongooseinit');

const Run = new mongoose.Schema({
Expand Down Expand Up @@ -75,7 +74,7 @@ Run.statics.findByRunId = async function findByRunId(runId) {

Run.statics.findRunsOlderThan = async function findRunsOlderThan(days) {
try {
return await Model.find({ createdAt: { $lte: moment().subtract(days, 'days').toDate() } }, '_id', { sort: { createdAt: 1 } }).exec();
return await Model.find({ createdAt: { $lte: dayjs().subtract(days, 'days').toDate() } }, '_id', { sort: { createdAt: 1 } }).exec();
}
catch (err) {
console.error('Error finding runs older than', err);
Expand Down
Loading

0 comments on commit ab02a35

Please sign in to comment.