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: ...@@ -94,18 +94,22 @@ workflow:
- "--" - "--"
- "/usr/bin/poky-entry.py" - "/usr/bin/poky-entry.py"
- "--id=118:998" - "--id=118:998"
variables:
MANUAL_BUILD: "false"
rules:
- if: $MANUAL_BUILD == "true"
when: manual
allow_failure: true
- when: always
artifacts: artifacts:
expire_in: 1 week expire_in: 1 week
reports: reports:
dotenv: build.env dotenv: build.env
paths: &artifacts_paths paths: &artifacts_paths
# List of all potential artifact paths. Not all of them are present in each build - ${ARTIFACTS_PATH}
# configuration, e.g. the SDK path exists in SDK builds only. We still specify all # The license manifest is not available on all builds (e.g. SDK builds), but if it
# of them here in order to have a generic build class for all builds. Pathsspecs # exists, we're adding it to the artifacts.
# which do not exist in a specific configuration are simply ignored by GitLab.
- build-*/tmp/deploy/images/**/*
- build-*/tmp/deploy/licenses/**/license.manifest - build-*/tmp/deploy/licenses/**/license.manifest
- build-*/tmp/deploy/sdk/*
- build.env - build.env
cache: cache:
# Cache the build artifacts for subsequent stages in the same pipeline # Cache the build artifacts for subsequent stages in the same pipeline
...@@ -175,6 +179,9 @@ workflow: ...@@ -175,6 +179,9 @@ workflow:
# Using misc runner because it runs on the same machine as the build runner. This # 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. # is the only way of being able to use the cache between build and package jobs.
- misc - misc
rules:
- if: $PACKAGE_TYPE == "image"
- if: $PACKAGE_TYPE == "sdk"
artifacts: artifacts:
paths: paths:
- release/**/**/* - release/**/**/*
...@@ -184,47 +191,30 @@ workflow: ...@@ -184,47 +191,30 @@ workflow:
before_script: before_script:
# We do this manually since we do not use GitLab's default artifact downloader # We do this manually since we do not use GitLab's default artifact downloader
- source build.env - 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: script:
# BUILD_PATH_* variables are available via build.env from build job # BUILD_PATH_* variables are available via build.env from build job
- if [[ "${PACKAGE_TYPE}" == "image" ]]; then
- .gitlab-ci/scripts/package_release.py - .gitlab-ci/scripts/package_release.py
--images-dir="${BUILD_PATH_IMAGE}" --images-dir="${BUILD_PATH_IMAGE}"
--licenses-dir="${BUILD_PATH_LICENSE}" --licenses-dir="${BUILD_PATH_LICENSE}"
--doc-dir=. --doc-dir=.
--output-dir=release --output-dir=release
--release-suffix="${RELEASE_SUFFIX}" --release-suffix="${RELEASE_SUFFIX}"
cache: - elif [[ "${PACKAGE_TYPE}" == "sdk" ]]; then
- <<: *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
- .gitlab-ci/scripts/package_release.py - .gitlab-ci/scripts/package_release.py
--sdk-dir="${BUILD_PATH_SDK}" --sdk-dir="${BUILD_PATH_SDK}"
--output-dir=release --output-dir=release
--release-suffix="${RELEASE_SUFFIX}" --release-suffix="${RELEASE_SUFFIX}"
- fi
cache: cache:
- <<: *pull_build_cache - key: ${CI_PIPELINE_ID}-${ASSOCIATED_BUILD_JOB}
policy: pull
paths: *artifacts_paths paths: *artifacts_paths
- *push_package_cache - key: ${CI_PIPELINE_ID}-${CI_JOB_NAME}
policy: push
paths:
- release
- package.env
# -------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------
# Stage: deploy # Stage: deploy
......
...@@ -95,6 +95,8 @@ build:check-foo-branch: ...@@ -95,6 +95,8 @@ build:check-foo-branch:
echo "ERROR: Branches do not match!" echo "ERROR: Branches do not match!"
exit 1 exit 1
fi fi
artifacts: null
cache: null
.simulate_build: .simulate_build:
extends: extends:
...@@ -120,6 +122,7 @@ simulate-build-seco-mx6: ...@@ -120,6 +122,7 @@ simulate-build-seco-mx6:
# branch, because we don't always execute the full pipeline on the master branches. # 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. # 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 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: cache:
- !reference [.buildbase, cache] - !reference [.buildbase, cache]
# Additionally cache the build artifacts for re-runs of this job in other pipelines # Additionally cache the build artifacts for re-runs of this job in other pipelines
...@@ -130,11 +133,10 @@ simulate-buildsdk-seco-mx6: ...@@ -130,11 +133,10 @@ simulate-buildsdk-seco-mx6:
extends: extends:
- .simulate_build - .simulate_build
- .buildbase - .buildbase
rules:
- when: manual
allow_failure: true
variables: variables:
BUILD_ARTIFACTS: https://git.seco.com/seco-ne/yocto/manifest/-/jobs/artifacts/kirkstone/3.0/download?job=buildsdk-seco-mx6 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: cache:
- !reference [.buildbase, cache] - !reference [.buildbase, cache]
# Additionally cache the build artifacts for re-runs of this job in other pipelines # Additionally cache the build artifacts for re-runs of this job in other pipelines
...@@ -183,16 +185,18 @@ smoketest:seco-mx6: ...@@ -183,16 +185,18 @@ smoketest:seco-mx6:
# Stage: Package # Stage: Package
# -------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------
package-seco-mx6: package-seco-mx6:
extends: .package_release extends: .package
variables: variables:
PACKAGE_TYPE: image
ASSOCIATED_BUILD_JOB: simulate-build-seco-mx6 ASSOCIATED_BUILD_JOB: simulate-build-seco-mx6
needs: needs:
- job: simulate-build-seco-mx6 - job: simulate-build-seco-mx6
artifacts: false artifacts: false
package-sdk-seco-mx6: package-sdk-seco-mx6:
extends: .package_sdk extends: .package
variables: variables:
PACKAGE_TYPE: sdk
ASSOCIATED_BUILD_JOB: simulate-buildsdk-seco-mx6 ASSOCIATED_BUILD_JOB: simulate-buildsdk-seco-mx6
needs: needs:
- job: simulate-buildsdk-seco-mx6 - job: simulate-buildsdk-seco-mx6
......
...@@ -51,31 +51,38 @@ changelog: ...@@ -51,31 +51,38 @@ changelog:
# -------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------
{% if CI_PARAM_IMAGE %} {% if CI_PARAM_IMAGE %}
build-{{ machine }}: build-{{ machine }}:
extends: .build_yocto_image extends: .build_yocto
variables: variables:
BITBAKE_TASK: build
CI_PARAM_MACHINE: {{ machine }} CI_PARAM_MACHINE: {{ machine }}
CI_PARAM_DISTRO: {{ CI_PARAM_DISTRO }} CI_PARAM_DISTRO: {{ CI_PARAM_DISTRO }}
CI_PARAM_IMAGE: {{ CI_PARAM_IMAGE }} CI_PARAM_IMAGE: {{ CI_PARAM_IMAGE }}
INSTALLSCRIPT: "fng-install.sh" INSTALLSCRIPT: "fng-install.sh"
ARTIFACTS_PATH: build-*/tmp/deploy/images/**/*
# Build jobs for the sdk # Build jobs for the sdk
buildsdk-{{ machine }}: buildsdk-{{ machine }}:
extends: .build_yocto_sdk extends: .build_yocto
variables: variables:
BITBAKE_TASK: populate_sdk
CI_PARAM_MACHINE: {{ machine }} CI_PARAM_MACHINE: {{ machine }}
CI_PARAM_DISTRO: {{ CI_PARAM_DISTRO }} CI_PARAM_DISTRO: {{ CI_PARAM_DISTRO }}
CI_PARAM_IMAGE: {{ CI_PARAM_IMAGE }} CI_PARAM_IMAGE: {{ CI_PARAM_IMAGE }}
ARTIFACTS_PATH: build-*/tmp/deploy/sdk/*
MANUAL_BUILD: "true"
{% endif %} {% endif %}
{% if CI_PARAM_IMAGE_FNG %} {% if CI_PARAM_IMAGE_FNG %}
# Build jobs for the fng system image # Build jobs for the fng system image
build-{{ machine }}-fngsystem: build-{{ machine }}-fngsystem:
extends: .build_yocto_image extends: .build_yocto
variables: variables:
BITBAKE_TASK: build
CI_PARAM_MACHINE: {{ machine }} CI_PARAM_MACHINE: {{ machine }}
CI_PARAM_DISTRO: {{ CI_PARAM_DISTRO_FNG }} CI_PARAM_DISTRO: {{ CI_PARAM_DISTRO_FNG }}
CI_PARAM_IMAGE: {{ CI_PARAM_IMAGE_FNG }} CI_PARAM_IMAGE: {{ CI_PARAM_IMAGE_FNG }}
INSTALLSCRIPT: "fngsystem-self-update.sh" INSTALLSCRIPT: "fngsystem-self-update.sh"
ARTIFACTS_PATH: build-*/tmp/deploy/images/**/*
{% endif %} {% endif %}
...@@ -136,8 +143,9 @@ platformtest:{{ machine }}: ...@@ -136,8 +143,9 @@ platformtest:{{ machine }}:
# -------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------
{% if CI_PARAM_IMAGE %} {% if CI_PARAM_IMAGE %}
package-{{ machine }}: package-{{ machine }}:
extends: .package_release extends: .package
variables: variables:
PACKAGE_TYPE: image
ASSOCIATED_BUILD_JOB: build-{{ machine }} ASSOCIATED_BUILD_JOB: build-{{ machine }}
needs: needs:
- job: build-{{ machine }} - job: build-{{ machine }}
...@@ -145,8 +153,9 @@ package-{{ machine }}: ...@@ -145,8 +153,9 @@ package-{{ machine }}:
- job: changelog - job: changelog
packagesdk-{{ machine }}: packagesdk-{{ machine }}:
extends: .package_sdk extends: .package
variables: variables:
PACKAGE_TYPE: sdk
ASSOCIATED_BUILD_JOB: buildsdk-{{ machine }} ASSOCIATED_BUILD_JOB: buildsdk-{{ machine }}
needs: needs:
- job: buildsdk-{{ machine }} - job: buildsdk-{{ machine }}
...@@ -155,8 +164,9 @@ packagesdk-{{ machine }}: ...@@ -155,8 +164,9 @@ packagesdk-{{ machine }}:
{% if CI_PARAM_IMAGE_FNG %} {% if CI_PARAM_IMAGE_FNG %}
package-{{ machine }}-fngsystem: package-{{ machine }}-fngsystem:
extends: .package_release extends: .package
variables: variables:
PACKAGE_TYPE: image
ASSOCIATED_BUILD_JOB: build-{{ machine }}-fngsystem ASSOCIATED_BUILD_JOB: build-{{ machine }}-fngsystem
needs: needs:
- job: build-{{ machine }}-fngsystem - job: build-{{ machine }}-fngsystem
......
...@@ -16,32 +16,34 @@ ...@@ -16,32 +16,34 @@
.dump_install_command: &dump_install_command .dump_install_command: &dump_install_command
# print install instructions # print install instructions
- |- - |-
SCRIPT="${CI_PROJECT_DIR}/${BUILDPATH}/${IMAGEPATH}/${INSTALLSCRIPT}" if [[ ! -z "${INSTALLSCRIPT}" ]]; then
if [ ! -f "${SCRIPT}" ]; then SCRIPT="${CI_PROJECT_DIR}/${BUILDPATH}/${IMAGEPATH}/${INSTALLSCRIPT}"
echo "Install script missing, searched for '$SCRIPT'" if [ ! -f "${SCRIPT}" ]; then
exit 1 echo "Install script missing, searched for '$SCRIPT'"
fi exit 1
fi
if [ "$CI_PROJECT_VISIBILITY" = "public" ];then
cat <<-EOF if [ "$CI_PROJECT_VISIBILITY" = "public" ];then
============================== cat <<-EOF
Install the image: ==============================
Install the image:
FNG="$FNG_INSTALL_URL"
curl --location "\$FNG" | sh -s -- --url="\$(dirname "\$FNG")" FNG="$FNG_INSTALL_URL"
============================== curl --location "\$FNG" | sh -s -- --url="\$(dirname "\$FNG")"
==============================
EOF EOF
else else
cat <<-EOF cat <<-EOF
============================== ==============================
Install the image: Install the image:
export GITLAB_TOKEN=<your_access_token> export GITLAB_TOKEN=<your_access_token>
FNG="$FNG_INSTALL_URL" FNG="$FNG_INSTALL_URL"
curl --location --header "PRIVATE-TOKEN: \$GITLAB_TOKEN" "\$FNG" \ curl --location --header "PRIVATE-TOKEN: \$GITLAB_TOKEN" "\$FNG" \
| sh -s -- --url="\$(dirname "\$FNG")" | sh -s -- --url="\$(dirname "\$FNG")"
============================== ==============================
EOF EOF
fi
fi fi
.build_script: &build_script .build_script: &build_script
...@@ -88,30 +90,12 @@ ...@@ -88,30 +90,12 @@
- !reference [.docker_check] - !reference [.docker_check]
- !reference [.setup_ssh] - !reference [.setup_ssh]
- !reference [.repo_checkout] - !reference [.repo_checkout]
.build_yocto_image:
extends:
- .build_yocto
variables:
BITBAKE_TASK: "build"
script: script:
- *save_build_env - *save_build_env
- *build_script - *build_script
- *collect_srcrevs - *collect_srcrevs
- *dump_install_command - *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 # Stage: Deploy SoftwareStore
# -------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------
......