grumpper
grumpper
TTask
Created by grumpper on 9/19/2024 in #help
What environment anad shell are task commands executed in?
found it! if you put everything you want in a script and invoke the script as follows:
#!/usr/bin/env bash

set -o pipefail

pylint --recursive=y . | tee reports/python/pylint.log
uci_logger $?
#!/usr/bin/env bash

set -o pipefail

pylint --recursive=y . | tee reports/python/pylint.log
uci_logger $?
and then setup the task simply like this:
test_py:
cmds:
- bash ./script.sh
test_py:
cmds:
- bash ./script.sh
everything works as expected: pipefail and $? work as intended without having to ignore any errors or break the execution.
4 replies
TTask
Created by grumpper on 9/16/2024 in #help
dotnev variable value calculation
i think I am trying to achieve conditional logic where preconditions is not the proper use case. i will mark the answer above as solved as this is the dotenv question after all.
7 replies
TTask
Created by grumpper on 9/16/2024 in #help
dotnev variable value calculation
Hmmm! You are correct that the final value is false. And the precondition should also be false unless I am declaring it wrong.
7 replies
TTask
Created by grumpper on 9/16/2024 in #help
dotnev variable value calculation
this is kinda weird though because i am seeing the opposite. I am trying to use it in github CI/CD automation (as part of a custom github action). My idea is for the user to provide a .env file with configuration (i.e. DEPLOY=true) but if the user don't do that I still get to set it up from my own .env file. So I tested it and if what you are saying was true it should have been true but was actually still false... This is the specific example: Here is the code:
version: '3'

silent: true

env:
CLIENT:
# The path to the client's repo's root
sh: echo $GITHUB_WORKSPACE
ACTION:
# The path to the custom action's repo root
sh: echo $GITHUB_ACTION_PATH

dotenv: ['{{.CLIENT}}/uci.env', '{{.ACTION}}/uci.env']

includes:
terraform_tasks:
taskfile: '{{.ACTION}}/tasks/terraform.yml'

tasks:
terraform_checks:
name: Run terraform CI checks
ignore_error: true
# Run a task from included task file
deps:
- terraform_tasks:default
preconditions:
- sh: '[[ "$TERRAFORM_CHECKS" == "true" ]]'

default:
deps:
- terraform_checks
version: '3'

silent: true

env:
CLIENT:
# The path to the client's repo's root
sh: echo $GITHUB_WORKSPACE
ACTION:
# The path to the custom action's repo root
sh: echo $GITHUB_ACTION_PATH

dotenv: ['{{.CLIENT}}/uci.env', '{{.ACTION}}/uci.env']

includes:
terraform_tasks:
taskfile: '{{.ACTION}}/tasks/terraform.yml'

tasks:
terraform_checks:
name: Run terraform CI checks
ignore_error: true
# Run a task from included task file
deps:
- terraform_tasks:default
preconditions:
- sh: '[[ "$TERRAFORM_CHECKS" == "true" ]]'

default:
deps:
- terraform_checks
In the client's side's uci.env the setting is TERRAFORM_CHECKS=false In the action's side is still TERRAFORM_CHECKS=true The step gets executed... 😦
7 replies