prefapp / firestarter-workflows

Repository with all firestarter workflows
0 stars 0 forks source link

New `auto` parameter to allow automatic flavor image build #94

Closed alambike closed 1 month ago

alambike commented 1 month ago

Motivation

We want to add a new parameter to the action's config file, to allow specify if a flavor should be built by default, i.e. when an * is passed as the flavors input (or no flavors input is set), through the automatic dispatches.

If the new auto config option is set to true (by default is set to false), the corresponding image flavors will be built when the * is passed as the flavors inputs (or no flavors input is specified)

snapshots:
my-flavor:
    build_args:
      VITE_API_URL: "https://my-api-url/graphql"
    dockerfile: docker/Dockerfile
    auto: true (default to false)

In this way, the features build_xxx workflows would build, by default (i.e. flavors=*) those images marked as auto: true.

If we trigger the build_xxx workflow manually, the flavors to build should be specified, and the auto flag will not be taken into account. If we specify an * in the flavors to build, we need an extra option to the cli (--skip_auto or --force) to indicate that we don't want to take into account the state of the auto flag.

https://github.com/prefapp/features/blob/main/packages/build_images/templates/.github/workflows/build_snapshots.yaml

on:
  workflow_dispatch:
    inputs:
      from:
        type: string
        description: Origin commit or tag
        required: true
        default: 'master'
      flavors:
        type: string
        description: Flavor name/s | one (alone), several(separated by commas)
        required: true
        default: "*"
      skip_auto:
        type: boolean
        description: Trigger the build of all the flavors specified, without taking into account the state of the auto flag
        required: false
        choice:
          - true
          - false