Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/integrations-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ jobs:
product: 'azure-kubernetes-service'
file_path: '__fixtures__/variables.tf'
regex: '(?<=default = \")([^\"]+)'
- uses: ./
name: Python (Version)
id: python
with:
product: python
version: 2.7

outputs:
prometheus_end_of_life: "${{ steps.prometheus.outputs.end_of_life }}"
Expand All @@ -55,6 +61,8 @@ jobs:
grafana_version: "${{ steps.grafana.outputs.version }}"
graylog_end_of_life: "${{ steps.graylog.outputs.end_of_life }}"
graylog_version: "${{ steps.graylog.outputs.version }}"
python_end_of_life: "${{ steps.python.outputs.end_of_life }}"
python_version: "${{ steps.python.outputs.version }}"

assert:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -90,3 +98,13 @@ jobs:
with:
expected: 'v5.2.12'
actual: "${{ needs.test.outputs.graylog_version }}"
- name: Assert Python EoL
uses: nick-fields/assert-action@v2
with:
expected: 'true'
actual: "${{ needs.test.outputs.python_end_of_life }}"
- name: Assert Python extracted version
uses: nick-fields/assert-action@v2
with:
expected: '2.7'
actual: "${{ needs.test.outputs.python_version }}"
32 changes: 17 additions & 15 deletions src/get_cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,25 +198,27 @@ def _construct_summary(result):

args = parser.parse_args()

if not args.file_path and not args.version:
sys.exit("Either file_path or version must be provided.")
# If version is supplied it supersedes others
if not args.version:
if not args.file_path:
sys.exit("Either file_path or version must be provided.")

if args.file_path and not (args.file_key or args.regex):
sys.exit(
"Either file_key or regex must be provided when extracting from file.")
if args.file_path and not (args.file_key or args.regex):
sys.exit(
"Either file_key or regex must be provided when extracting from file.")

if args.file_key and args.regex:
sys.exit("Only one of file_key or regex can be provided.")
if args.file_key and args.regex:
sys.exit("Only one of file_key or regex can be provided.")

if args.regex:
try:
re.compile(args.regex)
except re.error:
sys.exit(f"Invalid regular expression: '{args.regex}'")
args.file_format = "text"
if args.regex:
try:
re.compile(args.regex)
except re.error:
sys.exit(f"Invalid regular expression: '{args.regex}'")
args.file_format = "text"

if args.file_format not in ['yaml', 'json'] and not args.regex:
sys.exit("A regex must be provided when using text format.")
if args.file_format not in ['yaml', 'json'] and not args.regex:
sys.exit("A regex must be provided when using text format.")

result = get_product_cycle(args)
if not result:
Expand Down