1
0
mirror of https://github.com/hegerdes/gitlab-actions.git synced 2025-10-06 05:36:52 +02:00
Go to file
Henrik Gerdes 002ae42afd feat: add review envs for kube
Squashed commit of the following:

commit b143ef3c9988807b6d527e5ae9983524dace0d8e
Author: Henrik Gerdes <hegerdes@outlook.de>
Date:   Mon Jul 8 22:53:09 2024 +0200

    cleanup: examples for review env

    Signed-off-by: Henrik Gerdes <hegerdes@outlook.de>

commit 436a6737bf5f5ff748de03eab8e91d93fde6c118
Author: Henrik Gerdes <hegerdes@outlook.de>
Date:   Mon Jul 8 22:52:40 2024 +0200

    cleanup: examples for review env

    Signed-off-by: Henrik Gerdes <hegerdes@outlook.de>

commit 602fbcf259bb4514da14a1945615ca034fd56147
Author: Henrik Gerdes <hegerdes@outlook.de>
Date:   Mon Jul 8 22:36:21 2024 +0200

    fix: review env include

    Signed-off-by: Henrik Gerdes <hegerdes@outlook.de>

commit 441c049839917b7c87fa397c7f338fe3f8e6b17a
Author: Henrik Gerdes <hegerdes@outlook.de>
Date:   Mon Jul 8 22:30:38 2024 +0200

    fix: review env file name

    Signed-off-by: Henrik Gerdes <hegerdes@outlook.de>

commit e580d6e6be896b9ea403b4fe23df73caee1c4972
Author: Henrik Gerdes <hegerdes@outlook.de>
Date:   Mon Jul 8 22:29:30 2024 +0200

    feat: kubectl review env

    Signed-off-by: Henrik Gerdes <hegerdes@outlook.de>

Signed-off-by: Henrik Gerdes <hegerdes@outlook.de>
2024-07-08 23:06:13 +02:00
2024-07-08 23:06:13 +02:00
2024-05-29 18:21:05 +00:00
2023-12-22 23:45:58 +01:00
2024-07-07 20:15:01 +02:00
2023-12-22 22:23:05 +00:00
2024-01-06 19:14:27 +01:00
2024-05-29 18:21:05 +00:00

GitLab CI/CD Components

CI/CD Release

This repo contains a collection of different GotLab CI/CD Components.

Currently sported are:

NOTE: All components are arm64 ready. Gitlab now offers hosted ARM runners. You can use these when setting:

default:
  tags: [saas-linux-medium-arm64]

# or by including as a template and setting it by extending the job
include:
  - component: gitlab.com/hegerdes/gitlab-actions/kaniko-build@<VERSION>
    inputs:
      as_job: .my-kaniko-build

my-kaniko-build:
  tags: [saas-linux-medium-arm64]
  extends: .my-kaniko-build

Container Build: Kaniko

Usage

Use this component to build container images in your project without the need of a privileged Docker runner. It uses Googles kaniko project to allow safe image builds in Docker or Kubernetes. It automataticly adds metadata labels to the image for easy tracking when the image is deployed. You should add this component to an existing .gitlab-ci.yml file by using the include: keyword.

include:
  - component: gitlab.com/hegerdes/gitlab-actions/kaniko-build@<VERSION>

where <VERSION> is the latest released tag or main. This will add a container_build job to the pipeline.
NOTE: By default the latest version of kaniko is used. For a more predictable outcome you should pin the version to a specific tag via the build_image input.

The template should work without modifications but you can customize the template settings.

Inputs

Input Default value Description
as_job kaniko_build The name of the job that gets imported. Use ".my_job" to include as template
stage build The stage where you want the job to be added
build_image gcr.io/kaniko-project/executor:debug The Docker image of kaniko
push true When set to true the image will be pushed to the default registry. Set to false to only build without pushing the image.
CONTAINER_BUILD_USE_CACHE false When set to true kaniko will push build cache layers to the registry. Currently only the gitlab registry is supported.
image_tags [$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG] Array of the image tags to build.
context $CI_PROJECT_DIR The kaniko/docker build context.
dockerfile $CI_PROJECT_DIR/Dockerfile The path to the Dockerfile.
authors $CI_COMMIT_AUTHOR For OCI image label: Name of the image author(s).
source_url $CI_PROJECT_URL For OCI image label: Url of the source code.
project_url $CI_PROJECT_URL For OCI image label: Url of the project.
documentation_url $CI_PROJECT_URL For OCI image label: Url of the documentation.
version $CI_COMMIT_REF_NAME For OCI image label: Version of the image.
description $CI_PROJECT_DESCRIPTION For OCI image label: Description.
vendor UNKNOWN For OCI image label: Vendor name.
license UNKNOWN For OCI image label: License.

Variables

Variable Description
GIT_STRATEGY Default to fetch.
DOCKER_AUTH_CONFIG GitLab variable containing registry secrets.
CONTAINER_BUILD_EXTRA_ARGS Extra args for the build engine.

Container Build: buildah

Usage

Use this component to build container images in your project without the need of a privileged Docker runner. It uses Googles buildah project to allow safe image builds in Docker or Kubernetes. It automataticly adds metadata labels to the image for easy tracking when the image is deployed. Unlike kaniko buildah supports multiarch builds, while not officially supported by this component yes, you can activate it via the CONTAINER_BUILD_EXTRA_ARGS variable. You should add this component to an existing .gitlab-ci.yml file by using the include: keyword.

include:
  - component: gitlab.com/hegerdes/gitlab-actions/buildah-build@<VERSION>

where <VERSION> is the latest released tag or main. This will add a container_build job to the pipeline.
NOTE: By default the latest stable version of buildah is used. For a more predictable outcome you should pin the version to a specific tag via the build_image input.

The template should work without modifications but you can customize the template settings.

Inputs

Input Default value Description
as_job buildah_build The name of the job that gets imported. Use ".my_job" to include as template
stage build The stage where you want the job to be added
build_image gcr.io/kaniko-project/executor:debug The Docker image of kaniko
push true When set to true the image will be pushed to the default registry. Set to false to only build without pushing the image.
CONTAINER_BUILD_USE_CACHE false When set to true kaniko will push build cache layers to the registry. Currently only the gitlab registry is supported.
image_tags [$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG] Array of the image tags to build.
context $CI_PROJECT_DIR The kaniko/docker build context.
dockerfile $CI_PROJECT_DIR/Dockerfile The path to the Dockerfile.
authors $CI_COMMIT_AUTHOR For OCI image label: Name of the image author(s).
source_url $CI_PROJECT_URL For OCI image label: Url of the source code.
project_url $CI_PROJECT_URL For OCI image label: Url of the project.
documentation_url $CI_PROJECT_URL For OCI image label: Url of the documentation.
version $CI_COMMIT_REF_NAME For OCI image label: Version of the image.
description $CI_PROJECT_DESCRIPTION For OCI image label: Description.
vendor UNKNOWN For OCI image label: Vendor name.
license UNKNOWN For OCI image label: License.

Variables

Variable Description
GIT_STRATEGY Default to fetch.
DOCKER_AUTH_CONFIG GitLab variable containing registry secrets.
CONTAINER_BUILD_EXTRA_ARGS Extra args for the build engine.

Code Quality: pre-commit

Usage

Use this component to enforce the code quality via pre-commit config in CI. The original work was done by yesolutions. You should add this component to an existing .gitlab-ci.yml file by using the include: keyword.

include:
  - component: gitlab.com/hegerdes/gitlab-actions/pre-commit@<VERSION>

where <VERSION> is the latest released tag or main. This will add a pre-commit job to the pipeline.
NOTE: By default the latest version of the image python:3.12-slim is used. For a more predictable outcome you should pin the version to a specific tag via the image input.

The template should work without modifications but you can customize the template settings.

Inputs

Input Default value Description
as_job pre-commit The name of the job that gets imported. Use ".my_job" to include as template
stage .pre The stage where you want the job to be added
image python:3.12-slim The Docker image for pre-commit
autofix false When set to true it automatically try to fix the violating code and push it to gitlab. Needs PRE_COMMIT_ACCESS_TOKEN
access_token $CI_JOB_TOKEN Token used to push it to gitlab. Must be set if autofix is enabled
deduplicate_mr_and_branch true Don't add the job twice for branch and PR

Variables

Variable Description
GIT_STRATEGY Default to fetch.
PRE_COMMIT_ACCESS_TOKEN Token used to push it to gitlab. Must be set if autofix is enabled

For details, see the following links:

Contribute

Please read about CI/CD components and best practices at: https://docs.gitlab.com/ee/ci/components

Description
Collection of GitLab CI-CD-Catalog actions. Allows users to build Docker/OCI Container Images.
Readme BSD-2-Clause 176 KiB
Languages
Shell 88.8%
Smarty 7.7%
Python 3.2%
Dockerfile 0.3%