Skip to content

Commit

Permalink
feat: 🎸 Exposing git commit SHA in --version output
Browse files Browse the repository at this point in the history
  • Loading branch information
ziegfried committed Mar 6, 2021
1 parent 8f64313 commit e2ca052
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Pull latest pre-release image
run: docker pull ghcr.io/splunkdlt/ethlogger-pre:latest
- name: Build docker image
run: docker build -t ghcr.io/splunkdlt/ethlogger-pre:commit-$GITHUB_SHA . --cache-from ghcr.io/splunkdlt/ethlogger-pre:latest
run: docker build --build-arg ETHLOGGER_GIT_COMMIT=$GITHUB_SHA -t ghcr.io/splunkdlt/ethlogger-pre:commit-$GITHUB_SHA . --cache-from ghcr.io/splunkdlt/ethlogger-pre:latest
- name: Publish docker image
run: docker push ghcr.io/splunkdlt/ethlogger-pre:commit-$GITHUB_SHA
- name: Publish docker image
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Expand Up @@ -32,4 +32,7 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD ethlo
ENV NODE_ENV production
ENV NODE_OPTS --max-old-size=4096

ARG ETHLOGGER_GIT_COMMIT="n/a"
ENV ETHLOGGER_GIT_COMMIT $ETHLOGGER_GIT_COMMIT

ENTRYPOINT [ "ethlogger" ]
4 changes: 2 additions & 2 deletions docs/cli.md
Expand Up @@ -7,10 +7,10 @@ The ethlogger CLI tool is used to start and configure connections to the blockch
<!-- CLIREF -->

```
Splunk Connect for Ethereum
Ethlogger is an agent to gather metrics and blockchain information from an Ethereum node and ingest it in Splunk via its HTTP Event Collector. It is part of Splunk Connect for Ethereum.
USAGE
$ ethlogger
$ ethlogger --rpc-url=<rpc-url> [options]
OPTIONS
-c, --config-file=config-file
Expand Down
8 changes: 7 additions & 1 deletion src/index.ts
Expand Up @@ -25,12 +25,18 @@ import { InternalStatsCollector } from './utils/stats';
const { debug, error, info } = createModuleDebug('cli');

class Ethlogger extends Command {
static description = 'Splunk Connect for Ethereum';
static description =
'Ethlogger is an agent to gather metrics and blockchain information from an Ethereum node ' +
'and ingest it in Splunk via its HTTP Event Collector. It is part of Splunk Connect for Ethereum.';
static usage = '--rpc-url=<rpc-url> [options]';
static flags = CLI_FLAGS;

private resources: ManagedResource[] = [];

async run() {
if (process.env.ETHLOGGER_GIT_COMMIT != null) {
this.config.userAgent = `${this.config.userAgent} git-sha=${process.env.ETHLOGGER_GIT_COMMIT}`;
}
const { flags } = this.parse(Ethlogger);

if (flags.debug) {
Expand Down

0 comments on commit e2ca052

Please sign in to comment.