Skip to content

Commit

Permalink
Allow configuring of the nomad log level.
Browse files Browse the repository at this point in the history
#!skip-build-and-deploy!#
  • Loading branch information
jf-06 committed Jun 17, 2024
1 parent f56fcd6 commit 5263c2d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ jobs:
-e "s/{{{NOMAD_ENVIRONMENT}}}/${{ env.NOMAD_ENVIRONMENT }}/" \
-e "s/{{{NOMAD_CPU}}}/$(echo ${{ env.NOMAD_RESOURCES }} | cut -d: -f1)/" \
-e "s/{{{NOMAD_MEMORY}}}/$(echo ${{ env.NOMAD_RESOURCES }} | cut -d: -f2)/" \
-e "s/{{{NOMAD_LOG_LEVEL}}}/Information/" \
/_/_work/${{ github.repository }}/${{ github.sha }}/nomad/grid-bot.nomad > $NOMAD_JOB_FILE
# Run the job but do not wait for longer than 5 minutes
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ on:
required: true
default: "2000:1024"

log_level:
description: "The log level of the default logger"
required: true
default: "Information"
type: choice
options:
- "None"
- "Error"
- "Warning"
- "Information"
- "Debug"
- "Trace"

permissions:
deployments: write

Expand All @@ -51,6 +64,7 @@ jobs:
NOMAD_ENVIRONMENT: ${{ github.event.inputs.nomad_enviroment || 'production' }}
NOMAD_JOB_NAME: ${{ github.event.inputs.nomad_job_name || 'grid-bot' }}-${{ (github.event.inputs.nomad_enviroment || 'production') == 'production' && 'prod' || 'stage' }}
NOMAD_RESOURCES: ${{ github.event.inputs.nomad_resources || '2000:1024' }}
NOMAD_LOG_LEVEL: ${{ github.event.inputs.log_level || 'Information' }}

steps:
- name: Checkout
Expand Down Expand Up @@ -90,6 +104,7 @@ jobs:
-e "s/{{{NOMAD_ENVIRONMENT}}}/${{ env.NOMAD_ENVIRONMENT }}/" \
-e "s/{{{NOMAD_CPU}}}/$(echo ${{ env.NOMAD_RESOURCES }} | cut -d: -f1)/" \
-e "s/{{{NOMAD_MEMORY}}}/$(echo ${{ env.NOMAD_RESOURCES }} | cut -d: -f2)/" \
-e "s/{{{NOMAD_LOG_LEVEL}}}/${{ env.NOMAD_LOG_LEVEL }}/" \
./nomad/grid-bot.nomad > $NOMAD_JOB_FILE
# Run the job but do not wait for longer than 5 minutes
Expand Down
2 changes: 2 additions & 0 deletions nomad/grid-bot.nomad
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ job "{{{NOMAD_JOB_NAME}}}" {
DISPLAY=:1
DEFAULT_LOG_LEVEL={{{NOMAD_LOG_LEVEL}}}
# CONSUL
VAULT_ADDR="http://vault.service.consul:8200"
VAULT_TOKEN="{{ with secret "grid-bot-settings/grid-bot-vault" }}{{ .Data.data.vault_token }}{{ end }}"
Expand Down

0 comments on commit 5263c2d

Please sign in to comment.