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 (2)
......@@ -69,6 +69,18 @@ build-{{ machine }}:
# 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: ${BUILD_ARTIFACTS_PREFIX}-{{ machine }}
after_script:
# FIXME: This is necessary because we're using an old build for the build simulation
# which does not export these variables, yet. Can be removed as soon as we switch to
# a newer release already containing these variables.
- source build.env
# yamllint disable-line rule:line-length
{%- if machine == "seco-mx6" %}
- export SUPPORTED_HARDWARE=" SANTARO, SANTOKA, SANTINO, SANTINO LT, SANTVEND, "
{%- elif machine == "seco-mx8mm" %}
- export SUPPORTED_HARDWARE=" TANARO, "
{%- endif %}
- !reference [.save_build_env]
{% endif %}
......
......@@ -127,6 +127,8 @@ workflow:
- echo "DISTRO_RELEASE_ARTEFACTS='${DISTRO_RELEASE_ARTEFACTS}'" >> build.env
# Install script location is needed in test job
- echo "FNG_INSTALL_URL=${FNG_INSTALL_URL}" >> build.env
# Supported hardware is needed for Confluence release page
- echo "SUPPORTED_HARDWARE='${SUPPORTED_HARDWARE}'" >> build.env
# --------------------------------------------------------------------------------------
# Stage: Infrastructure
......@@ -264,16 +266,6 @@ workflow:
- echo "Getting Yocto build artifacts"
- wget -O artifacts.zip ${BUILD_ARTIFACTS}
- unzip artifacts.zip
after_script:
# FIXME: This is necessary because we're using an old build for the build simulation
# which does not export these variables, yet. Can be removed as soon as we switch to
# a newer release already containing these variables, then they can be read from the
# existing build.env from the cache.
# yamllint disable-line rule:line-length
- export TOOLCHAIN_OUTPUTNAME="seconorth-wayland-glibc-x86_64-seconorth-image-cortexa9t2hf-neon-$MACHINE-toolchain-kirkstone-7.0"
# yamllint disable-line rule:line-length
- export DISTRO_RELEASE_ARTEFACTS="seconorth-image-$MACHINE.tar.gz seconorth-image-$MACHINE.manifest seconorth-image-$MACHINE.testdata.json fng-install.sh pkg.py"
- *save_build_env
cache:
- *cache
# Additionally cache the build artifacts for re-runs of this job in other pipelines
......@@ -474,9 +466,13 @@ workflow:
- .gitlab-ci/scripts/render_jinja2_template.py
--template="${PAGE_TEMPLATE}"
> confluence-page.xml
- .gitlab-ci/scripts/render_jinja2_template.py
--template=.gitlab-ci/confluence-labels.txt.jinja2
> confluence-labels.txt
artifacts:
paths:
- confluence-page.xml
- confluence-labels.txt
.publish-confluence-page:
extends:
......@@ -489,6 +485,10 @@ workflow:
- generate-confluence-page
- build-version
script:
- LABEL_ARGS=""
- while IFS= read -r line; do
[ -n "$line" ] && LABEL_ARGS="${LABEL_ARGS} --label=$line";
done < confluence-labels.txt
- .gitlab-ci/scripts/confluence_create_or_update_page.py
--username="${CONFLUENCE_USERNAME}"
--token="${CONFLUENCE_TOKEN}"
......@@ -497,6 +497,7 @@ workflow:
--page-name="${RELEASE_NAME}"
--content-file=confluence-page.xml
--label="os-release"
${LABEL_ARGS}
# --------------------------------------------------------------------------------------
......
{%- for hardware in SUPPORTED_HARDWARE.split(',') | sort %}
{%- if hardware | trim | length %}
{{ hardware | trim | lower | replace(" ", "-")}}
{%- endif %}
{%- endfor %}
......@@ -23,6 +23,16 @@
{%- endfor %}
</td>
</tr>
<tr>
<th><b>Supported Hardware</b></th>
<td>
{%- for hardware in SUPPORTED_HARDWARE.split(',') | sort %}
{%- if hardware | trim | length %}
<p>{{ hardware | trim }}</p>
{%- endif %}
{%- endfor %}
</td>
</tr>
<tr>
<th><b>Documentation</b></th>
<td>
......
......@@ -63,12 +63,12 @@ yocto-simulation-pipeline:
- .yocto-deploy
variables:
BUILD_ARTIFACTS_PREFIX: >-
https://git.seco.com/seco-ne/yocto/manifest/-/jobs/artifacts/kirkstone/7.0/download?job=build
https://git.seco.com/seco-ne/yocto/manifest/-/jobs/artifacts/kirkstone/14.0/download?job=build
YOCTO_IMAGE: seconorth-image
YOCTO_DISTRO: seconorth-wayland
SETUP_SCRIPT: /dev/null
INSTALL_SCRIPT: fng-install.sh
BITBAKE_ENV_COMMAND: echo DISTRO_VERSION="kirkstone-7.0"
BITBAKE_ENV_COMMAND: echo DISTRO_VERSION="kirkstone-14.0"
ARTIFACTS_PATH: build-*/tmp/deploy/images/**/*
PACKAGE_TYPE: image
TEST_STAGE: "true"
......@@ -85,7 +85,7 @@ sdk-simulation-pipeline:
- .yocto-deploy
variables:
BUILD_ARTIFACTS_PREFIX: >-
https://git.seco.com/seco-ne/yocto/manifest/-/jobs/artifacts/kirkstone/7.0/download?job=buildsdk
https://git.seco.com/seco-ne/yocto/manifest/-/jobs/artifacts/kirkstone/14.0/download?job=buildsdk
YOCTO_IMAGE: seconorth-image
YOCTO_DISTRO: seconorth-wayland
SETUP_SCRIPT: /dev/null
......
......@@ -13,8 +13,8 @@ from download_job_artifacts import download_job_artifact
from get_pipeline_jobs import get_pipeline_jobs
def get_deploy_variables(
gitlab: Gitlab, project: Project, deploy_jobs: list[ProjectPipelineJob]
def get_job_env_variables(
gitlab: Gitlab, project: Project, jobs: list[ProjectPipelineJob], env_file: str
):
"""Get a list of deploy variables from the deploy.env files from the given deploy
jobs. If a variable is set to different values in different jobs, the values are
......@@ -30,9 +30,8 @@ def get_deploy_variables(
Dictionary of deploy variables with 'name' and 'value' fields
"""
variables = {}
env_file = "deploy.env"
for job in deploy_jobs:
for job in jobs:
with tempfile.NamedTemporaryFile() as target_file:
print(f"Downloading file {env_file} from job {job.name}", file=sys.stderr)
......@@ -48,6 +47,7 @@ def get_deploy_variables(
for line in lines:
name, value = line.partition("=")[::2]
value = value.strip("'")
variables[name] = (
f"{variables[name]}\n{value}"
if name in variables and variables[name] != value
......@@ -141,12 +141,15 @@ def main():
gitlab = Gitlab(args.gitlab_url, private_token=args.token)
project = common.get_project(gitlab, args.project)
jobs = get_pipeline_jobs(gitlab, project, args.pipeline, stage="Build")
variables = get_job_env_variables(gitlab, project, jobs, "build.env")
jobs = get_pipeline_jobs(gitlab, project, args.pipeline, stage=args.deploy_stage)
successful_jobs = [job for job in jobs if job.status == "success"]
if not successful_jobs:
exit(f"ERROR: no successful jobs found in stage '{args.deploy_stage}'")
variables = get_deploy_variables(gitlab, project, successful_jobs)
variables |= get_job_env_variables(gitlab, project, successful_jobs, "deploy.env")
files = get_deployed_files(gitlab, project, successful_jobs)
......