mirror of
https://github.com/diced/zipline.git
synced 2025-12-12 07:40:45 -08:00
fix: silently error out when no git sha #864
This commit is contained in:
9
.github/ISSUE_TEMPLATE/bug.yml
vendored
9
.github/ISSUE_TEMPLATE/bug.yml
vendored
@@ -3,15 +3,6 @@ description: Report a reproducible bug in Zipline
|
|||||||
title: 'Bug: [short description of the issue]'
|
title: 'Bug: [short description of the issue]'
|
||||||
labels: ['bug']
|
labels: ['bug']
|
||||||
body:
|
body:
|
||||||
- type: checkboxes
|
|
||||||
id: agree
|
|
||||||
attributes:
|
|
||||||
label: Confirm bug report
|
|
||||||
description: Please make sure that this is a bug with Zipline and not with any external services. Dealing with reproducible bugs help us a ton when trying to fix them. Please check the following that apply to this report.
|
|
||||||
options:
|
|
||||||
- label: "✅ This bug is a Zipline bug and is reproducible"
|
|
||||||
- label: "❌ I am not sure if this is a Zipline bug (it may be due to a configuration, user error, or external service)"
|
|
||||||
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: what-happened
|
id: what-happened
|
||||||
attributes:
|
attributes:
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import { version } from '../../package.json';
|
import { version } from '../../package.json';
|
||||||
import { execSync } from 'child_process';
|
import { execSync } from 'child_process';
|
||||||
|
import { log } from './logger';
|
||||||
|
|
||||||
|
const logger = log('version');
|
||||||
|
|
||||||
export function gitSha() {
|
export function gitSha() {
|
||||||
const envValue = process.env.ZIPLINE_GIT_SHA;
|
const envValue = process.env.ZIPLINE_GIT_SHA;
|
||||||
@@ -9,7 +12,10 @@ export function gitSha() {
|
|||||||
const commitHash = execSync('git rev-parse --short HEAD').toString().trim();
|
const commitHash = execSync('git rev-parse --short HEAD').toString().trim();
|
||||||
return commitHash;
|
return commitHash;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error getting git commit hash:', error);
|
if (!(error instanceof Error)) return null;
|
||||||
|
|
||||||
|
logger.warn('failed to get commit hash: ' + error.message);
|
||||||
|
logger.debug('failed to get commit hash', { error: JSON.stringify(error) });
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ export default fastifyPlugin(
|
|||||||
server.get<{ Querystring: Query }>(PATH, { preHandler: [userMiddleware] }, async (req, res) => {
|
server.get<{ Querystring: Query }>(PATH, { preHandler: [userMiddleware] }, async (req, res) => {
|
||||||
if (!config.features.metrics) return res.forbidden('metrics are disabled');
|
if (!config.features.metrics) return res.forbidden('metrics are disabled');
|
||||||
|
|
||||||
if (config.features.metrics.adminOnly && !isAdministrator(req.user.role)) return res.forbidden('admin only');
|
if (config.features.metrics.adminOnly && !isAdministrator(req.user.role))
|
||||||
|
return res.forbidden('admin only');
|
||||||
|
|
||||||
const { from, to, all } = req.query;
|
const { from, to, all } = req.query;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user