Publish from the CLI

The CLI does not expose the build-time auto-publish option. Create the build, wait for it to complete, then apply an ImagePromotion manifest.

Procedure

  1. Create an ImageBuild manifest and apply it. For a complete example, see Creating an image build from the CLI.
  2. Wait until the build completes:
    $ flightctl get imagebuild/<image_build_name>
  3. Optional: create ImageExport resources for disk formats you want in the catalog. See Image export.
  4. Create an ImagePromotion manifest. The following example publishes to a new item in the default catalog:
    apiVersion: flightctl.io/v1alpha1
    kind: ImagePromotion
    metadata:
      name: <promotion_name>
    spec:
      source:
        imageBuildRef: <image_build_name>
        exportFormats:
          - container
          - qcow2
      target:
        type: NewCatalogItem
        catalogName: default
        catalogItemName: <catalog_item_name>
        displayName: <display_name>
        version: "1.0.0"
  5. Apply the promotion and watch its status:
    $ flightctl apply -f imagepromotion.yaml
    $ flightctl get imagepromotion/<promotion_name> -o yaml

    Wait until status.phase is Completed. If the phase is WaitingForArtifacts, wait for exports to finish or adjust exportFormats.

  6. Verify the catalog item:
    $ flightctl get catalogitems --catalog default