Files
iopsyswrt/.gitlab-ci.yml
Andreas Gnau ba9b1b8543 CI: Build (but not push) container img for MRs
Run the container build on merge requests. Until there is a solution for
cleaning up container images from MRs, do not push the resulting images
anywhere for now. This change at least enables verification of any
Dockerfile changes when submitting an MR.

Signed-off-by: Andreas Gnau <andreas.gnau@iopsys.eu>
2024-07-26 18:24:07 +02:00

101 lines
2.8 KiB
YAML

variables:
SKIP_TEST: "false"
FF_SCRIPT_SECTIONS: "true"
stages:
- Update docker image
- Update code-analysis Docker image
- IOWRT
.continuous:
stage: IOWRT
trigger:
project: devops/iopsyswrt
strategy: depend
rules:
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
Update Docker Image:
stage: Update docker image
tags:
- priority
image:
name: gcr.io/kaniko-project/executor:v1.9.1-debug
entrypoint: [""]
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"${REGISTRY_URL}\":{\"auth\":\"${REGISTRY_AUTH}\"}}}" > /kaniko/.docker/config.json
- |
if [ "${CI_COMMIT_REF_NAME:-}" = "${CI_DEFAULT_BRANCH}" ]; then
echo "On default branch '$CI_DEFAULT_BRANCH', going to push 'latest' tag for container image as well"
DO_PUSH_LATEST=1
fi
- |
if [ "$CI_COMMIT_REF_PROTECTED" = true ]; then
echo "On protected branch, going to push container image to registries"
DO_PUSH=1
else
echo "Not on a protected branch. Only going to build the image, not going to push it"
NO_PUSH=1
fi
- |
set -x && /kaniko/executor \
--context "${CI_PROJECT_DIR}" \
--cache \
--cache-copy-layers \
--cache-repo "${CI_REGISTRY_IMAGE}/sdk-builder/cache" \
--dockerfile "${CI_PROJECT_DIR}/Dockerfile" \
${NO_PUSH:+--no-push} \
${NO_PUSH:+--no-push-cache} \
${DO_PUSH:+--destination "${REGISTRY_REPOSITORY}:${CI_COMMIT_SHA}"} \
${DO_PUSH:+--destination "${CI_REGISTRY_IMAGE}/sdk-builder:${CI_COMMIT_SHA}"} \
${DO_PUSH:+--destination "${REGISTRY_REPOSITORY}:${CI_COMMIT_REF_NAME}"} \
${DO_PUSH:+--destination "${CI_REGISTRY_IMAGE}/sdk-builder:${CI_COMMIT_REF_NAME}"} \
${DO_PUSH_LATEST:+--destination "${REGISTRY_REPOSITORY}:latest"} \
${DO_PUSH_LATEST:+--destination "${CI_REGISTRY_IMAGE}/sdk-builder:latest"}
rules:
- if: '$CI_COMMIT_REF_PROTECTED == "true"'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
interruptible: true
code-analysis:
stage: Update code-analysis Docker image
trigger:
project: iopsys/gitlab-ci-pipeline
strategy: depend
branch: $CI_COMMIT_REF_NAME
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
allow_failure: true
# For select devices that support the EVAL profile
.variables_eval:
variables:
CUSTOMER_PROFILE: "EVAL"
SKIP_TEST: "true"
# Continuous Builds:
# Qualcomm
SH40J_continuous:
extends:
- .continuous
- .variables_eval
variables:
BOARD_NAME: "SH40J"
# Broadcom
SH31B_continuous:
extends:
- .continuous
- .variables_eval
variables:
BOARD_NAME: "SH31B"
# MediaTek
CW3B_continuous:
extends:
- .continuous
- .variables_eval
variables:
BOARD_NAME: "CW3B"