Skip to content
Snippets Groups Projects
Commit b43dedcf authored by Zygmunt Krynicki's avatar Zygmunt Krynicki
Browse files

ci: prototype new CI infrastructure


The documentation repository relies on a series of symbolic links that
connect it to the oniro.git repository, when used inside a checked-out
repo workspace.

Ever since we switched to the symlink-based override that supports
branch selection for merge requests and merge trains, the docs
repository stopped to build correctly.

This is caused by now-broken symbolic links that once traversed, no
longer point to the files in oniro.git, due to the way the redirection
code works.

An entirely new pipeline was created to avoid this problem, and to unify
other repo-hacking systems that we introduced over time. A prototype of
this new pipeline is now available here, in the docs repository.

The main difference is that local manifests are now used to edit the
repo composition before "repo sync" is used. This allows us to achieve
the same effect we had before, but using first-party systems. The
secondary difference is that the docs pipeline is now separated from
changes (including breaking changes) in the oniro.git pipeline.

Signed-off-by: default avatarZygmunt Krynicki <zygmunt.krynicki@huawei.com>
parent 5e5c2fe7
No related branches found
No related tags found
1 merge request!19ci: prototype new CI infrastructure
Pipeline #10308 failed
...@@ -13,7 +13,6 @@ include: ...@@ -13,7 +13,6 @@ include:
file: file:
- .oniro-ci/dco.yaml - .oniro-ci/dco.yaml
- .oniro-ci/reuse.yaml - .oniro-ci/reuse.yaml
- .oniro-ci/build-generic.yaml
dco: dco:
extends: .dco extends: .dco
...@@ -26,49 +25,123 @@ reuse: ...@@ -26,49 +25,123 @@ reuse:
rules: rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
# Customize the .workspace job to set the path of the git repository to deviate
# from what the git-repo manifest prepares. This effectively allows testing # Naming scheme for variables is defined as follows:
# incoming changes that match the repository holding this CI pipeline. #
.workspace: # CI_ONIRO_*:
# Oniro specific variables used during CI/CD process. Variables in this group
# should use meaningful names and avoid abbreviations, if possible.
#
# CI_ONIRO_BB_LOCAL_CONF_*:
# Mechanism for injecting variables into Bitbake configuration files.
# Variables in this group represent existing Bitbake/Yocto variables and
# retain their original name, apart from the prefix.
#
# CI_*:
# Third party variables used during CI/CD process, defined by GitLab.
# Variables in this group are defined by GitLab and retain their original
# name.
#
# GIT_STRATEGY, CACHE_COMPRESSOIN_LEVEL:
# Part of GitLab interface.
.oniro-repo-workspace:
interruptible: true
image:
name: registry.ostc-eu.org/ostc/oniro/bitbake-builder:latest
variables: variables:
CI_ONIRO_GIT_REPO_PATH: docs GIT_STRATEGY: none
CACHE_COMPRESSION_LEVEL: fastest
CI_ONIRO_REPO_WORKSPACE_URL: https://gitlab.eclipse.org/eclipse/oniro-core/oniro.git
CI_ONIRO_REPO_WORKSPACE_REV: kirkstone
CI_ONIRO_REPO_WORKSPACE_DIR: $CI_PROJECT_DIR/.cache/repo-workspace
CI_ONIRO_REPO_WORKSPACE_CACHE_PREFIX: workspace
CI_ONIRO_REPO_WORKSPACE_LOCAL_MANIFEST: >
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<!-- remove original docs project entry -->
<remove-project name="oniro-core/docs.git" />
<!-- add remote representing the project -->
<remote name="oniro-override" fetch="${CI_PROJECT_URL}/../" />
<!-- add docs at the exact version are testing -->
<project name="${CI_PROJECT_NAME}" path="docs" remote="oniro-override" revision="${CI_COMMIT_SHA}" />
</manifest>
cache:
- key: $CI_ONIRO_REPO_WORKSPACE_CACHE_PREFIX-$CI_ONIRO_REPO_WORKSPACE_REV
paths: [$CI_ONIRO_REPO_WORKSPACE_DIR]
when: always
before_script:
- |
function gl_section_open() {
printf '\e[0K''section_start'':%s:%s\r\e[0K%s\n' "$(date +%s)" "$1" "$2"
}
function gl_section_open_collapsed() {
printf '\e[0K''section_start'':%s:%s[collapsed=true]\r\e[0K%s\n' "$(date +%s)" "$1" "$2"
}
function gl_section_close() {
printf '\e[0K''section_end'':%s:%s\r\e[0K\n' "$(date +%s)" "$1"
}
- gl_section_open_collapsed system_info "Querying system information"
- uname -a
- cat /etc/os-release
- free -m
- lscpu
- env | grep -E '^CI_ONIRO' | sort
- gl_section_close system_info
- gl_section_open_collapsed setup_git "Setting up git"
- git config --global --add safe.directory "$CI_PROJECT_DIR"
- git config --global user.name "CI/CD Automation"
- git config --global user.email "ci-cd@example.org"
- gl_section_close setup_git
- gl_section_open_collapsed workspace_setup "Setting up repo workspace"
- mkdir -p "$CI_ONIRO_REPO_WORKSPACE_DIR"
- pushd "$CI_ONIRO_REPO_WORKSPACE_DIR"
- echo "Initializing repository workspace from $CI_ONIRO_REPO_WORKSPACE_URL and $CI_ONIRO_REPO_WORKSPACE_REV"
- repo init --manifest-url "$CI_ONIRO_REPO_WORKSPACE_URL" --manifest-branch "$CI_ONIRO_REPO_WORKSPACE_REV" --no-clone-bundle
- mkdir -p "${CI_ONIRO_REPO_WORKSPACE_DIR}/.repo/local_manifests"
- test -n "${CI_ONIRO_REPO_WORKSPACE_LOCAL_MANIFEST-}" && echo "$CI_ONIRO_REPO_WORKSPACE_LOCAL_MANIFEST" | tee "${CI_ONIRO_REPO_WORKSPACE_DIR}/.repo/local_manifests/local.xml"
- echo "Synchronizing repository workspace"
- repo sync --force-sync
- gl_section_close workspace_setup
# Disable all the bitbake jobs, since we are not building any code here.
.bitbake-workspace:
rules:
- when: never
# Define a build-docs job that extends both the .workspace, for the general
# workspace setup, and .build-docs, for the documentation build logic. The
# script first assembles the workspace and then proceeds to build the
# documentation.
#
# The job extends more than one parent, with the order being relevant for,
# among others, the "rules" section.
build-docs: build-docs:
extends: [.workspace, .build-docs] extends: [.oniro-repo-workspace]
variables: interruptible: true
CI_ONIRO_INSTANCE_SIZE: s3.large.2 image:
name: registry.ostc-eu.org/ostc/oniro/docs-builder:latest
script: script:
- !reference [.workspace, script] - make -C docs
- !reference [.build-docs, script] - mv docs/build "$CI_PROJECT_DIR"
# Artifacts are relative to CI_PROJECT_DIR so we need to provide the build
# docs there.
- mv "$SCRATCH_DIR"/docs/build/ "$CI_PROJECT_DIR" || true
artifacts: artifacts:
paths: paths:
- build - build
rules: rules:
# Build the docs when a merge request is created. # Build the docs when a merge request is created.
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
variables:
CI_ONIRO_REPO_WORKSPACE_LOCAL_MANIFEST: >
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<!-- remove original docs project entry -->
<remove-project name="oniro-core/docs.git" />
<!-- add remote representing the project -->
<remote name="oniro-override" fetch="${CI_MERGE_REQUEST_SOURCE_PROJECT_URL}/../" />
<!-- add docs at the exact version are testing -->
<project name="${CI_PROJECT_NAME}" path="docs" remote="oniro-override" revision="${CI_COMMIT_SHA}" />
</manifest>
# Or when things land. # Or when things land.
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
deploy: deploy:
extends: .workspace extends: .oniro-repo-workspace
stage: deploy stage: deploy
script: script:
- !reference [.workspace, script]
# We are in the root of the git-repo workspace. # We are in the root of the git-repo workspace.
- git clone https://user:$CI_ONIRO_AGGREGATED_DOCS_TOKEN@gitlab.eclipse.org/eclipse/oniro-core/oniro-readthedocs-aggregated.git aggregated - git clone https://user:$CI_ONIRO_AGGREGATED_DOCS_TOKEN@gitlab.eclipse.org/eclipse/oniro-core/oniro-readthedocs-aggregated.git aggregated
- find aggregated -maxdepth 1 -not -path aggregated/.git -not -path aggregated -exec rm -rvf {} \; - find aggregated -maxdepth 1 -not -path aggregated/.git -not -path aggregated -exec rm -rvf {} \;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment