Code Monkey home page Code Monkey logo

automotive-ci's Introduction

An opinionated operator that facilitates using OpenShift for Automotive-related development.

Introduction

The purpose of this operator is to facilitate the configuration of development tasks for code repositories that are used by the Automotive SIG on public clouds, on-premise environments, or hybrid clouds, using the OpenShift platform.

Development tasks that were identified so far are:

  1. Nightly builds: build container images, and optionally other artifacts, with their latest third-party dependencies every day and publish the artifacts publicly.
  2. CI/CD: integrate the build-test-publish flow in Automotive-related repositories (on various platforms, like GitLab and GitHub).
  3. Facilitate the creation of custom artifacts with pending changes on different platforms.

Design

For the sake of simplicity, we implemented this with an Ansible based operator.

The properties for each code repository are defined in a custom resource ContainerBuild. The operator acts on ContainerBuild entities and create a pipeline and other entities for the code repository that is specified in the ContainerBuild instance, in the namespace that the ContainerBuild instance resides in. By removing the ContainerBuild instance, all the derived entities would be removed from the OpenShift cluster.

The definition of the aforementioned derived entities are stored in the form of templates of the 'containerbuild' role and are applied by the 'main' task for the 'containerbuild' role. These are the resources that are most likely to change. Another resource that is likely to change is the Role-based access control (RBAC) rules for the operator.

Examples of ContainerBuild definitions can be found in the config/samples folder. Further examples can be found in the deployment folder for ContainrBuild instances we defined for the CentOS Automotive SIG Container Images projects.

Deploying the Operator

Next we'll explain how to deploy the operator to an OpenShift cluster. The operator is not published to the Operator Hub and there is no plan to publish it there so we show how to do it from source, assuming this repository was cloned and you logged in to the OpenShift cluster already.

First, you need to choose where to publish the image of the operator and set the IMG environment variable accordingly, e.g., IMG=quay.io/ahadas/autoci, and then run the docker-build and docker-push targets in the Makefile to build and push it, respectively. Second, run the deploy target to deploy the operator to the OpenShift cluster.

Configure a Source Code Repository

After deploying the operator, it waits for per-respository configuration to be posted to the OpenShift cluster. You look at the examples in the deployment folder for references of ContainerBuild configurations. We will demonstrate the process for the automotive-osbuild repository using the [automotive-osbuild.yaml] configuration that is stored in the deployment folder. For further details about the supported configuration properties, see the default settings here.

Deploy a ContainerBuild instance:

oc apply -f deployment/automotive-osbuild.yaml

As a result, a new pipeline that can build, test, and push a container image from the repository will be created. The pipeline is named after the ContainerBuild instance and resides within the same namespace as the ContainerBuild instance.

TODO: explain how to set a secret for the image registry

Nightly Builds

Nightly builds can be disabled by specifying nightly_builds: false in the ContainerBuild instance. However, when nightly builds are not disabled, the operator creates a daily cron job that triggers the abovementioned pipeline.

You can trigger this cron job immediately by creating a job from it:

oc -n autosd create job test --from=cronjob/automotive-osbuild-nightly

GitLab Integration

By default, the GitLab integration is disabled. You can enable it by specifying gitlab: true in the ContainerBuild instance.

TODO: explain that a route for a webhook is created, how to set tokens

More Resources

automotive-ci's People

Contributors

ahadas avatar liranr23 avatar

Stargazers

Michael Kuehl avatar

Watchers

 avatar

Forkers

odra

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.