Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • seco-ne/yocto/infrastructure/gitlab-ci
1 result
Show changes
Commits on Source (4)
  • Tim Jaacks's avatar
    Yocto build: make main artifacts path configurable · f892500f
    Tim Jaacks authored
    Instead of specifying all possible artifacts paths and abusing the fact
    that GitLab ignores non-existing paths during artifact upload, implement
    a cleaner solution with a configurable path.
    f892500f
  • Tim Jaacks's avatar
    Yocto build: unify image and SDK build jobs · e6d71996
    Tim Jaacks authored
    Image and SDK builds share a lot of similar code. Instead of having two
    job classes `build_yocto_image` and `build_yocto_sdk` for these two
    tasks, merge them into the base class `build_yocto` and make the
    differences configurable via a variable.
    
    The `dump_install_command` part of the script, which was not executed
    for SDK builds, is always present now, but it's only executed if the
    `INSTALLSCRIPT` variable is set, which is not the case for SDK builds.
    
    The `collect_srcrevs` part of the script is executed in all cases. It
    was not part of the SDK build before, but it's not less relevant there.
    e6d71996
  • Tim Jaacks's avatar
    Yocto build: add variable for manual builds · 8e72eac2
    Tim Jaacks authored
    Instead of hard-coding the rules for manual builds in each actual job,
    conditionally add this to the `buildbase` class and add a variable
    `MANUAL_BUILD` to the according jobs.
    8e72eac2
  • Tim Jaacks's avatar
    Yocto build: unify image and SDK package jobs · 5762a54c
    Tim Jaacks authored
    Image and SDK package jobs call the same package script just with
    different arguments. Instead of having two job classes `package_release`
    and `package_sdk` for these two tasks, merge them into the base class
    `package` and make the differences configurable via a variable
    `PACKAGE_TYPE`.
    5762a54c
......@@ -94,18 +94,22 @@ workflow:
- "--"
- "/usr/bin/poky-entry.py"
- "--id=118:998"
variables:
MANUAL_BUILD: "false"
rules:
- if: $MANUAL_BUILD == "true"
when: manual
allow_failure: true
- when: always
artifacts:
expire_in: 1 week
reports:
dotenv: build.env
paths: &artifacts_paths
# List of all potential artifact paths. Not all of them are present in each build
# configuration, e.g. the SDK path exists in SDK builds only. We still specify all
# of them here in order to have a generic build class for all builds. Pathsspecs
# which do not exist in a specific configuration are simply ignored by GitLab.
- build-*/tmp/deploy/images/**/*
- ${ARTIFACTS_PATH}
# The license manifest is not available on all builds (e.g. SDK builds), but if it
# exists, we're adding it to the artifacts.
- build-*/tmp/deploy/licenses/**/license.manifest
- build-*/tmp/deploy/sdk/*
- build.env
cache:
# Cache the build artifacts for subsequent stages in the same pipeline
......@@ -175,6 +179,9 @@ workflow:
# Using misc runner because it runs on the same machine as the build runner. This
# is the only way of being able to use the cache between build and package jobs.
- misc
rules:
- if: $PACKAGE_TYPE == "image"
- if: $PACKAGE_TYPE == "sdk"
artifacts:
paths:
- release/**/**/*
......@@ -184,47 +191,30 @@ workflow:
before_script:
# We do this manually since we do not use GitLab's default artifact downloader
- source build.env
.pull_build_cache: &pull_build_cache
key: ${CI_PIPELINE_ID}-${ASSOCIATED_BUILD_JOB}
policy: pull
.push_package_cache: &push_package_cache
key: ${CI_PIPELINE_ID}-${CI_JOB_NAME}
policy: push
paths:
- release
- package.env
.package_release:
extends:
- .package
script:
# BUILD_PATH_* variables are available via build.env from build job
- if [[ "${PACKAGE_TYPE}" == "image" ]]; then
- .gitlab-ci/scripts/package_release.py
--images-dir="${BUILD_PATH_IMAGE}"
--licenses-dir="${BUILD_PATH_LICENSE}"
--doc-dir=.
--output-dir=release
--release-suffix="${RELEASE_SUFFIX}"
cache:
- <<: *pull_build_cache
paths: *artifacts_paths
- *push_package_cache
.package_sdk:
extends:
- .package
script:
# BUILD_PATH_* variables are available via build.env from build job
- elif [[ "${PACKAGE_TYPE}" == "sdk" ]]; then
- .gitlab-ci/scripts/package_release.py
--sdk-dir="${BUILD_PATH_SDK}"
--output-dir=release
--release-suffix="${RELEASE_SUFFIX}"
- fi
cache:
- <<: *pull_build_cache
- key: ${CI_PIPELINE_ID}-${ASSOCIATED_BUILD_JOB}
policy: pull
paths: *artifacts_paths
- *push_package_cache
- key: ${CI_PIPELINE_ID}-${CI_JOB_NAME}
policy: push
paths:
- release
- package.env
# --------------------------------------------------------------------------------------
# Stage: deploy
......
......@@ -95,6 +95,8 @@ build:check-foo-branch:
echo "ERROR: Branches do not match!"
exit 1
fi
artifacts: null
cache: null
.simulate_build:
extends:
......@@ -120,6 +122,7 @@ simulate-build-seco-mx6:
# branch, because we don't always execute the full pipeline on the master branches.
# In those cases the actual build job does not exist, which results in a 404 error.
BUILD_ARTIFACTS: https://git.seco.com/seco-ne/yocto/manifest/-/jobs/artifacts/kirkstone/3.0/download?job=build-seco-mx6
ARTIFACTS_PATH: build-*/tmp/deploy/images/**/*
cache:
- !reference [.buildbase, cache]
# Additionally cache the build artifacts for re-runs of this job in other pipelines
......@@ -130,11 +133,10 @@ simulate-buildsdk-seco-mx6:
extends:
- .simulate_build
- .buildbase
rules:
- when: manual
allow_failure: true
variables:
BUILD_ARTIFACTS: https://git.seco.com/seco-ne/yocto/manifest/-/jobs/artifacts/kirkstone/3.0/download?job=buildsdk-seco-mx6
ARTIFACTS_PATH: build-*/tmp/deploy/sdk/*
MANUAL_BUILD: "true"
cache:
- !reference [.buildbase, cache]
# Additionally cache the build artifacts for re-runs of this job in other pipelines
......@@ -183,16 +185,18 @@ smoketest:seco-mx6:
# Stage: Package
# --------------------------------------------------------------------------------------
package-seco-mx6:
extends: .package_release
extends: .package
variables:
PACKAGE_TYPE: image
ASSOCIATED_BUILD_JOB: simulate-build-seco-mx6
needs:
- job: simulate-build-seco-mx6
artifacts: false
package-sdk-seco-mx6:
extends: .package_sdk
extends: .package
variables:
PACKAGE_TYPE: sdk
ASSOCIATED_BUILD_JOB: simulate-buildsdk-seco-mx6
needs:
- job: simulate-buildsdk-seco-mx6
......
......@@ -51,31 +51,38 @@ changelog:
# --------------------------------------------------------------------------------------
{% if CI_PARAM_IMAGE %}
build-{{ machine }}:
extends: .build_yocto_image
extends: .build_yocto
variables:
BITBAKE_TASK: build
CI_PARAM_MACHINE: {{ machine }}
CI_PARAM_DISTRO: {{ CI_PARAM_DISTRO }}
CI_PARAM_IMAGE: {{ CI_PARAM_IMAGE }}
INSTALLSCRIPT: "fng-install.sh"
ARTIFACTS_PATH: build-*/tmp/deploy/images/**/*
# Build jobs for the sdk
buildsdk-{{ machine }}:
extends: .build_yocto_sdk
extends: .build_yocto
variables:
BITBAKE_TASK: populate_sdk
CI_PARAM_MACHINE: {{ machine }}
CI_PARAM_DISTRO: {{ CI_PARAM_DISTRO }}
CI_PARAM_IMAGE: {{ CI_PARAM_IMAGE }}
ARTIFACTS_PATH: build-*/tmp/deploy/sdk/*
MANUAL_BUILD: "true"
{% endif %}
{% if CI_PARAM_IMAGE_FNG %}
# Build jobs for the fng system image
build-{{ machine }}-fngsystem:
extends: .build_yocto_image
extends: .build_yocto
variables:
BITBAKE_TASK: build
CI_PARAM_MACHINE: {{ machine }}
CI_PARAM_DISTRO: {{ CI_PARAM_DISTRO_FNG }}
CI_PARAM_IMAGE: {{ CI_PARAM_IMAGE_FNG }}
INSTALLSCRIPT: "fngsystem-self-update.sh"
ARTIFACTS_PATH: build-*/tmp/deploy/images/**/*
{% endif %}
......@@ -136,8 +143,9 @@ platformtest:{{ machine }}:
# --------------------------------------------------------------------------------------
{% if CI_PARAM_IMAGE %}
package-{{ machine }}:
extends: .package_release
extends: .package
variables:
PACKAGE_TYPE: image
ASSOCIATED_BUILD_JOB: build-{{ machine }}
needs:
- job: build-{{ machine }}
......@@ -145,8 +153,9 @@ package-{{ machine }}:
- job: changelog
packagesdk-{{ machine }}:
extends: .package_sdk
extends: .package
variables:
PACKAGE_TYPE: sdk
ASSOCIATED_BUILD_JOB: buildsdk-{{ machine }}
needs:
- job: buildsdk-{{ machine }}
......@@ -155,8 +164,9 @@ packagesdk-{{ machine }}:
{% if CI_PARAM_IMAGE_FNG %}
package-{{ machine }}-fngsystem:
extends: .package_release
extends: .package
variables:
PACKAGE_TYPE: image
ASSOCIATED_BUILD_JOB: build-{{ machine }}-fngsystem
needs:
- job: build-{{ machine }}-fngsystem
......
......@@ -16,32 +16,34 @@
.dump_install_command: &dump_install_command
# print install instructions
- |-
SCRIPT="${CI_PROJECT_DIR}/${BUILDPATH}/${IMAGEPATH}/${INSTALLSCRIPT}"
if [ ! -f "${SCRIPT}" ]; then
echo "Install script missing, searched for '$SCRIPT'"
exit 1
fi
if [ "$CI_PROJECT_VISIBILITY" = "public" ];then
cat <<-EOF
==============================
Install the image:
FNG="$FNG_INSTALL_URL"
curl --location "\$FNG" | sh -s -- --url="\$(dirname "\$FNG")"
==============================
if [[ ! -z "${INSTALLSCRIPT}" ]]; then
SCRIPT="${CI_PROJECT_DIR}/${BUILDPATH}/${IMAGEPATH}/${INSTALLSCRIPT}"
if [ ! -f "${SCRIPT}" ]; then
echo "Install script missing, searched for '$SCRIPT'"
exit 1
fi
if [ "$CI_PROJECT_VISIBILITY" = "public" ];then
cat <<-EOF
==============================
Install the image:
FNG="$FNG_INSTALL_URL"
curl --location "\$FNG" | sh -s -- --url="\$(dirname "\$FNG")"
==============================
EOF
else
cat <<-EOF
==============================
Install the image:
export GITLAB_TOKEN=<your_access_token>
FNG="$FNG_INSTALL_URL"
curl --location --header "PRIVATE-TOKEN: \$GITLAB_TOKEN" "\$FNG" \
| sh -s -- --url="\$(dirname "\$FNG")"
==============================
else
cat <<-EOF
==============================
Install the image:
export GITLAB_TOKEN=<your_access_token>
FNG="$FNG_INSTALL_URL"
curl --location --header "PRIVATE-TOKEN: \$GITLAB_TOKEN" "\$FNG" \
| sh -s -- --url="\$(dirname "\$FNG")"
==============================
EOF
fi
fi
.build_script: &build_script
......@@ -88,30 +90,12 @@
- !reference [.docker_check]
- !reference [.setup_ssh]
- !reference [.repo_checkout]
.build_yocto_image:
extends:
- .build_yocto
variables:
BITBAKE_TASK: "build"
script:
- *save_build_env
- *build_script
- *collect_srcrevs
- *dump_install_command
.build_yocto_sdk:
extends:
- .build_yocto
variables:
BITBAKE_TASK: "populate_sdk"
rules:
- when: manual
allow_failure: true
script:
- *save_build_env
- *build_script
# --------------------------------------------------------------------------------------
# Stage: Deploy SoftwareStore
# --------------------------------------------------------------------------------------
......