Skip to content

Commit

Permalink
[CI] use string choice instead of boolean
Browse files Browse the repository at this point in the history
boolean input behavior is counterintuitive on GHA, it returns a string
even though the choices are boolean. Instead use a string choice for
clarity.
  • Loading branch information
msherman64 committed Sep 26, 2023
1 parent 2fb11a6 commit 5e30668
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
26 changes: 19 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,28 @@ on:
kolla_build_pattern:
description: "Kolla image build pattern (e.g., '^ironic-')"
push:
type: boolean
type: choice
description: "Push images to registry? (true/false)"
required: true
default: false
default: 'false'
options:
- 'true'
- 'false'
tag:
description: "Override default tag"
cache:
type: boolean
type: choice
default: 'false'
options:
- 'true'
- 'false'
pull:
type: boolean
description: "Should kolla-build pull the OS bas image before build"
type: choice
default: 'false'
options:
- 'true'
- 'false'

env:
DOCKER_REGISTRY: ghcr.io
Expand All @@ -36,13 +48,13 @@ jobs:
if: github.event.inputs.kolla_build_pattern != ''
run: echo "KOLLA_BUILD_PATTERN=${{ github.event.inputs.kolla_build_pattern }}" >> $GITHUB_ENV
- name: Set push argument from workflow inputs
if: github.event.inputs.push == true
if: github.event.inputs.push == 'true'
run: echo "SHOULD_PUSH=1" >> $GITHUB_ENV
- name: Set Cache argument from workflow inputs
if: github.event.inputs.cache == true
if: github.event.inputs.cache == 'true'
run: echo "KOLLA_CACHE=1" >> $GITHUB_ENV
- name: Set Pull argument from workflow inputs
if: github.event.inputs.pull == true
if: github.event.inputs.pull == 'true'
run: echo "PULL=1" >> $GITHUB_ENV
- name: Set tag argument from workflow inputs
if: github.event.inputs.tag != ''
Expand Down
4 changes: 2 additions & 2 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ def main():
if environ.get("KOLLA_CACHE", None):
kolla_argv.append("--cache")

if environ.get("PULL", None) == 1:
if environ.get("PULL", None) == "1":
kolla_argv.append("--pull")

if environ.get("SHOULD_PUSH", None) == 1:
if environ.get("SHOULD_PUSH", None) == "1":
kolla_argv.append("--push")

build_tag = environ.get("DOCKER_TAG", None)
Expand Down

0 comments on commit 5e30668

Please sign in to comment.