Build Image

This workflow uses Kaniko to build and archive a Docker image. The image tag is created based on user inputs, Git tags, or commit information. The image is built, saved as a `.tar` file, and the digest is retrieved using crane. Finally, the image, tag, and digest are uploaded as artifacts. To use this component, you need to have a `Dockerfile` in your repository's root directory.

The build-image workflow accepts the following inputs:

NameDescriptionRequiredDefault Value
api_urlThe DevGuard API URLNohttps://api.main.devguard.org
asset_nameName of the asset to scanYes
tokenAPI token for authenticating with DevGuardYes
scan_stageThe stage where the scan is runNotest
runner_tagsThe runner tags used to select appropriate CI runners.No""
build_stageThe stage where the image is built and taggedNobuild
build_argsThe build arguments to pass to the Kaniko build command’No--context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile
push_imagePushes the image directly to the registry instead of uploading as an artifactNofalse

Usage Example: Here’s an example of how to call this component:

include:
- remote: "https://gitlab.com/l3montree/devguard/-/raw/main/templates/build-image.yml@main
  inputs:
    asset_name: "myOrgnaization/projects/myProject/assets/myAsset"
    token: "$DEVGUARD_TOKEN"