Skip to content

Commit e858a1e

Browse files
committed
Update no-such-version test
Now print a message before moving on.
1 parent f488777 commit e858a1e

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

.github/workflows/test-version.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -626,12 +626,14 @@ jobs:
626626
path: tests/workflows/test-version/empty
627627
workspace: hello
628628

629-
- name: Check failed to download no such version
629+
- name: Check the version
630630
env:
631-
OUTCOME: ${{ steps.no-such-version.outcome }}
631+
DETECTED_TERRAFORM_VERSION: ${{ steps.no-such-version.outputs.terraform }}
632632
run: |
633-
if [[ "$OUTCOME" != "failure" ]]; then
634-
echo "Did not fail correctly"
633+
echo "The terraform version was $DETECTED_TERRAFORM_VERSION"
634+
635+
if [[ "$DETECTED_TERRAFORM_VERSION" != *"1.11"* ]]; then
636+
echo "::error:: Latest version was not used"
635637
exit 1
636638
fi
637639

image/src/terraform_version/env.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import sys
34
from typing import Iterable, Optional
45

56
from github_actions.debug import debug
@@ -18,6 +19,7 @@ def try_read_env(actions_env: ActionsEnv, versions: Iterable[Version]) -> Option
1819
try:
1920
valid_versions = list(apply_constraints(versions, [Constraint(c) for c in constraint.split(',')]))
2021
if not valid_versions:
22+
sys.stdout.write(f'The constraint {constraint} does not match any available versions\n')
2123
return None
2224
return latest_version(valid_versions)
2325

0 commit comments

Comments
 (0)