My openeuler community engagement Tour

Time:2020-10-23

What is openeuler?

Openeuler is an open source, free Linux distribution platform. It will build an open, pluralistic and architecture inclusive software ecosystem with global developers through an open community. At the same time, openeuler is also an innovative platform to encourage anyone to put forward new ideas, develop new ideas and practice new solutions on this platform.

Installation interface:

My openeuler community engagement Tour

Openeuler’s official website: https://openeuler.org/

Repo download address: https://repo.openeuler.org

Documentation Manual:https://openeuler.org/zh/docs/20.03_LTS/docs/Releasenotes/release_notes.html

My openeuler community engagement Tour

How to plan openeuler version?

My openeuler community engagement Tour

My openeuler community engagement Tour

explain:

  1. There are innovative version and lts (long term support) version.
  2. Following the upstream first principle, the software package comes directly from the native community and feeds back to the native community.
  3. The master branch is the development branch of the latest version. Once the innovative version or lts version is released,

    Openeuler innovative Version (non LTS)openEulerLTS version positioning builds developer ecology, new features are active, version evolution is fast, supporting partners to build commercial distribution release cycle 0.5 years 2 years maintenance cycle 0.5 years 4 years or more quality standard is low, in the standard Fedora quality requirements, the key work of standard CentOS quality requirementsNew featuresBugfix, CVE, upgrade selection, etcFinite propertiesCurrently, there are no corresponding branches of bugfix and CVE. The latest branch of the next version of openeuler-20.09 openeuler-20.03lts

How to build openeuler version?

Openeuler building model:

My openeuler community engagement Tour

How to build a version:

My openeuler community engagement Tour

explain:

Name Description note code cloud openler group is a native project initiated by the openeuler community, which is equivalent to one upstream community. For example, isula, atune projects.https://gitee.com/openeulerCode cloud SRC openeuler group stores the code in the form of RPM source code. Each repository source code can directly build RPM binaries.https://gitee.com/src-openeulerOBSopenBuild service, a set of open source construction system released by openSUSE, similar to koji, yacto, etc.https://build.openeuler.orghttps/ / openbuildservice.orgjenkinsCI/CD , continuous integration platform, mainly used for access control task, version construction task scheduling, etchttp://114.116.250.98/repoDeliverable and Yum software source for archiving and publishing.https://repo.openeuler.org/

What software is included in the openeuler version?

The most intuitive way is to visit openeuler’s official repo to see the release.

ReleaseBuild tool repoFiling addressISO: DVD ISO, debuginfo isoeverything isosource isomkddiso (to be open source), kiwihttp://repo.openeuler.org/openEuler-20.03-LTS/ISOQcow2Create image (to be open source)http://repo.openeuler.org/openEuler-20.03-LTS/docker_imgContainer image kiwihttp://repo.openeuler.org/openEuler-20.03-LTS/virtual_machine_imgLiveCD ?  …

Another way is to visit the build project on openeuler obs to know which software is included in each version and what the current build status is.

Version OBS project description constraint address master trunk openEuler:Factory (new package introduction) new software is added. First, it is introduced to the openeuler software workshop. The master branch code builds rpm and will not be integrated into ISO or repohttps://build.openeuler.org/project/show/openEuler:FactoryopenEuler:Mainline The main line project and the packages involved in the master branch code will be released along with the version of openeulerhttps://build.openeuler.org/project/show/openEuler:MainlineLTSedition openEuler:20.03 : ltslts version build project, openeuler-20.03-lts branch codehttps://build.openeuler.org/project/show/openEuler:20.03:LTS20.09Version (branch not pulled) —-

How is software managed?

Openeuler source code warehouse management:

  • All openeuler code is hosted in gitee.com
  • There are openeuler and SRC openeuler groups
  • All are source code, configuration management

groupopeneulersrc-openeulerLocation code warehouse, native community software package warehouse, product warehouse content openeuler initiated native project spec RPM format archive software package repository URLhttps://gitee.com/openeulerhttps://gitee.com/src-openeulerThe number of warehouses 50 + 2500 + code management source tree SRC RPM format relationship is the upstream community of SRC openeuler

The current management of openeuler software isIt is carried by sig group, all the softwareUnique to a sig。 adoptsigs.yaml fileYou can find out which sig the software belongs to, and you can check it throughSigs proprietary ArchiveYou can query the corresponding maintainer.Only the corresponding maintainer has permission to merge the corresponding warehouse code.

My openeuler community engagement Tour

Under openeuler / community repository, the following three files are important:

sig/sigs.yamlManage and maintain the software package under each SIG, and divide the scope of software package managed by sig.

repository/openeuler.yamlThe software package warehouse information maintained under openeuler.

repository/src-openeuler.yaml)Software package warehouse information maintained under SRC openeuler.

By modifying these files, we can add and delete the software package warehouse, and divide the corresponding software package into SIG, so as to realize the right management of the software package by the owner of SIG.

Learn about openeuler sigs

SIG is the abbreviation of special interest group. The openeuler community is organized according to different sigs to facilitate better management and improve workflow.

  • SIG group and SIG’s mailing list is open. Anyone and group are welcome to join and contribute.
  • SIG is established for one or more technical topics. Members of the sig drive the output of the delivery and strive to make it part of the openeuler community distribution.
  • The core members of SIG dominate the governance of SIG. Please checkRole description of SIG。 You can contribute while accumulating experience and enhancing influence.
  • Each sig will have one or more projects on gitee, and these projects will have one or more repositories. The delivery of SIG will be kept in these repositories.
  • Issue can be submitted in the repository corresponding to SIG, participate in discussion for specific problems, submit and solve problems, participate in review, etc.
  • You can also communicate with members of the sig through mailing lists, IRC or video conferencing.

Maintenance strategy of openeuler sig

  1. Openeuler has divided many basic sigs vertically according to the domain and direction of all software.
  2. Each independent software belongs to a unique sig. The maintainer of SIG manages the software package involved in the SIG and reviews it regularly.
  3. Orthogonal and coupling should be avoided between sigs, the granularity should be reasonable, and the scale of software warehouse should be avoided to be too large.
  4. When a new sig is established, it is necessary to know whether the same or similar sig already exists in the current openeuler.
  5. When applying for a new SIG, we should consider communicating with other sigs to take over the software involved in the sig field.
  6. The establishment, operation and abandonment of SIG are supervised by TC Committee.

Openeuler community development panorama?

My openeuler community engagement Tour

The figure above shows the openeuler community development guidelines.

explain:

  1. Software package management is divided into three parts according to the time point of software package:

My openeuler community engagement Tour

My openeuler community engagement Tour

My openeuler community engagement Tour

  1. The input of each stage is round box with green background, such as

My openeuler community engagement Tour

  1. All development and maintenance actions are triggered by the issue. Issues can be divided into requirements, problems, CVEs and so on.

My openeuler community engagement Tour

  1. All modifications and operations are initiated through pr.
  2. In the panorama, each action may involve specification or guidance. It will be presented in tabular form later.

Specifications involved in panorama:

Introduction of stage action standard or guidance

My openeuler community engagement Tour

Guidance: how to apply for sig–

My openeuler community engagement Tour

standard:Software package introduction and exit requirementsGuidance: openeuler package guide — to be output–

My openeuler community engagement Tour

standard:Package package specificationDevelopment & maintenance

My openeuler community engagement Tour

Specification: Specification for software package upgrade and selection — to be output–

My openeuler community engagement Tour

Guidance:Package package specification

My openeuler community engagement Tour

standard:Package package specificationGuidance: how to submit PR, initiate review and join validation — to be output–

My openeuler community engagement Tour

standard:Openeuler vulnerability handling processstandard:Openeuler vulnerability severity assessmentGuidance:How to apply for CVE and vulnerability reporting

My openeuler community engagement Tour

Specification: openeuler software package release specification with version — to be output — Guidance: how to add software package to openeuler release — to be output–

My openeuler community engagement Tour

standard:Security vulnerability handling and release processsign out

My openeuler community engagement Tour

standard:Software package introduction and exit requirements

How to contribute to the openeuler community?

The first step is that open source doesn’t mean people want to do what they want,Signing cla“Contributor license agreement”The first step is to read and follow the openeuler community’sCode of conduct

The second step starts with understanding, installing, using and testing openeuler,Positive feedback on questions and suggestions, relatedDocumentation and manuals, and relatedreal-time infoIt can help you learn more about openeuler.

Third, after the developers are familiar with the development process of the community——Contributor GuideOpen Euler can submit their own projects based on their own contributions.

Understanding gitee workflow

  • preparation
  • Fork warehouse

My openeuler community engagement Tour

  • Clone to local

My openeuler community engagement Tour

  • Branching
  • Modify validation submission
  • Push to code cloud
  • Create pr

My openeuler community engagement Tour

  • Focus on code review comments

My openeuler community engagement Tour

  • Update pr

Suggestions:

  1. For related modifications, separate branches are pulled to modify the submission, and PR is created. If you can, commit one branch at a time.
  2. When PR is integrated, the latest code can be forced to be synchronized to the personal warehouse.

My openeuler community engagement Tour

  1. Do not commit code on the master. When PR is not merged, forced synchronization will fail.

What can developers do in the openeuler community?

Including but not limited to:

  • Submit some requirements and implement them as much as possible
  • Commit a bug and fix it
  • Reporting vulnerability and vulnerability handling
  • Put forward some suggestions, including not limited to website improvement, document improvement, process specification improvement, experience improvement, etc.
  • Add new software to the community
  • Launch new community projects

Combined with the previous developer panorama, it can be decomposed into the following actions:

1. Create issue, submit requirements & Issues & Suggestions

  • Ask questions: if you find and want to report a problem or defect to the community, the way to submit a problem is to create an issue. You just submit the issue to the issue list of the project repository in the form of issue and view itIssue submission GuideFor more information. When you submit a question,Please observe as much as possibleQuestion submission criteria.
  • offer a proposal: if you want to contribute your opinions or suggestions to the sig field, you can also share them with you by submitting an issue. You can have full communication and Discussion on this issue. To attract more attention, you can also attach a link to issue to an email and send it to everyone via a mailing list.
  • Put forward the demand: if you want a feature or technology to be implemented on openeuler, you can submit the requirement class issue,A clear and complete description helps team members understand and be accepted and incorporated into the development plan more quickly.

2. Submit PR to fix a problem (bug, CVE, new feature)

When you submit a PR, you are already contributing code to the community. Please refer toOpeneuler community PR submission guidanceAndCode cloud PR submission process

matters needing attention

  • Openeuler only accepts the form of PR to submit code, and it is not allowed to directly push the code to the repository under openeuler.
  • First of all, you should find the warehouse corresponding to the repair problem tosrc-openEuler/mockFor example, click the fork button to copy the warehouse code to the personal name.

My openeuler community engagement Tour

  • Transfer the code git clone locally. If your modification does not involve the change of binary source software package, make the modified code into a patch, because the repository is organized in the format of RPM source code package.
  • Each PR triggers the openeuler access control check, including unnamed, code specification, and code build. The results of access control will be echoed in the comments later, and the failed check items should be corrected in time.
  • Through the openeuler RPM build link in the entrance guard, you can find the temporary RPM binary of this submitted build layer by layer. The generated binary will be echoed directly to the comments.

My openeuler community engagement Tour

My openeuler community engagement Tour

  • Code reviewers can give their own opinions on the submission. When they approve your submission, they will/lgtmTo give OK’s opinion.
  • The maintainers of the warehouse have permission to join in,/approveIf there are conflicts, you need to resolve them in advance.
  • For reviews given by others. If code modification is involved, you can usegit commit --amend; git push -fTo update PR in the same pr.

View code:

Openeuler is an open community, and we want all the people who participate in the community to become active viewers. It can be referred toCommunity members, which describes the roles and responsibilities of different contributors.

For contributorsIn order to make your submission easier to accept, you need to:

  • Follow the coding conventions of the sig group, if any
  • Prepare well submitted information
  • If a large amount of code is submitted at a time, it is recommended to decompose the large content into a series of logically smaller contents. Submitting separately will make it easier for the viewer to understand your idea
  • Use the appropriate sig group and monitor tag to mark PR: the community robot will send you messages to facilitate you to better complete the PR process

For the viewerIt is strongly recommended thatCode of conductTo transcend ourselves, respect each other and promote cooperation.Soft art of patch auditingThis paper puts forward a series of key points of the review, and explains that code review activities also hope to promote the active participation of new contributors, without making contributors be inundated with subtle errors at the beginning. Therefore, when reviewing, we can focus on the following aspects:

  • Is the idea behind the contribution reasonable
  • Is the contribution structured correctly
  • Is the contribution perfect

Note: if your PR request doesn’t get enough attention, you can do it in sig’s mailing list or[email protected]seek help.

Here is aExamples for reference

3. Create interest groups

stateDiagram

[*] — find sig list

Search sig list > Add sig: already exists

Search sig list > submit PR by template: does not exist

Submit PR — > subscription email according to the template and apply for topics

Subscription email, application topic — > TC review

TC review — > join PR: review passed

TC review — > submit PR according to template: failed

Enter PR — > [*]

Add sig > [*]

My openeuler community engagement Tour

SIG list: gitee.com/openeuler/community/tree/master/sig

TC mailing list: gitee.com/openeuler/community/tree/master/zh/technical -committee

PR template: gitee.com/openeuler/community/tree/master/sig/sig -template

Sample submission: gitee.com/openeuler/community/pulls/398

Find the sig or project you are interested in

Finding the sig groups you are interested in can help you ask questions in the right place and get faster community response.

  • Method 1: if you don’t know what sigs or projects there are, you can check them outSIG list, which contains a list of all sig teams currently established by the openeuler community. Through this list, you can quickly locate the sig team corresponding to your field of interest. At the same time, we will also provide you with the following information about the sig team: the projects under the SIG, as well as the communication methods in the SIG, including mailing list, IRC or video conference, etc
  • Mode 2: if you know the name of the project you are interested in, you can make a fuzzy search under the repository list of openeuler to quickly locate the front page address of the corresponding project. In general, theREADME.mdIn the document, the sig information, communication methods, members and contact information of the project can be found.

If neither of the above methods can locate the sig you are interested in, you can[email protected]Send email for help. We suggest that you use “[development process questions]” as the title in the mailing list, and write down the characteristics of the sig or project you are looking for in the content. We will help you.

Once you’re sure you want to create a group, you can follow theTemplateCreate a new sig directory and submit PR toCommunity warehouseAnd apply for the topic (subscription) at the TC regular meeting [email protected] And pay attention to the e-mails collected on the topics). After everyone’s consensus, the incorporation into PR represents the success of SIG.

Here is a PR submission to create sig golangSpecific examples, including sig’s raidmap, responsibilities, managed warehouse (maybe transferred from other sigs), contact information and maintainer.

4. Contribution package

stateDiagram

[*] — find software

Find software — > [*]: already exists

Find software > Import software: does not exist

Introduce software to determine the sig

Determine whether the sig — > sig exists

Does sig exist? > create sig interest group: not exist

Does sig exist? > Add warehouse under corresponding sig: Yes

Add warehouse under corresponding sig

Review integration — > [*]

My openeuler community engagement Tour

When you find that the openeuler community is missing the software you need, you can try to contribute the software package to the community. Here we will not repeat how the OS is composed of Linux software package and how to make an RPM package. This article focuses on the process of contribution software package.

  • First of all, it is necessary to make clear the function of the software package and follow theIntroduction and exit principles of openeuler software package
  • Furthermore, since the software only belongs to a SIG, you need to check whether there is a suitable sig bearer at present. If not, you need to apply for the establishment of a new sig according to step 3.
  • Then, you can add the software warehouse under the corresponding sig by submitting pr. For referenceThis submissionOnce it is approved, the background will automatically create a warehouse with the same name under the corresponding SRC openeuler group, andFactoryIn the project, create the package with the same name and start the construction. Since there is only readme in the default warehouse, the actual construction will not be carried out, but the state of exclude.

My openeuler community engagement Tour

  • Then you can submit a PR according to 2 to upload the code that can be built. Once joined, the factory project triggers the build.

My openeuler community engagement Tour

  • The software package conforms to the package specification, please refer toHow to pack
  • The successful construction results of all software packages under the project are filed in:

My openeuler community engagement Tour

My openeuler community engagement Tour

Openeuler OBS usage

These two articles help you understand the basic use of OBS.How to use openeuler OBS – (1)andHow to use openeuler OBS – (2) linkage with gitee

What is OBS?

OBS is the abbreviation of open build service (official website:https://openbuildservice.org/),

It was originally used as a special RPM packaging platform for distribution openSUSE, and then expanded to a multi distribution, multi architecture, multi format packaging and publishing platform.

My openeuler community engagement Tour

Different from Koji

  • Management scope

Unlike koji, which only manages packages (including source and binary packages), OBS manages both source and package repositories. Koji starts to take over a package after it is compiled. It determines the location of the package according to its NVR (name version release) and stores it after compilation verification. OBS is managed from the source phase, it has its own package version mark and changelog log log.OBS can save the historical version of source code like GIT and manage the source code branch。 And generate the binary package and source package of each version.

In other words, OBS can implement the functions of koji and git at the same time. >The format of source code accepted by OBS is different from that of GIT, so OBS cannot completely replace GIT.

  • Applicable format

OBS can generate packages in RPM, Deb and other formats, while koji is only suitable for RPM format.

  • Support rest API

It is convenient to test framework and build project call.

How to configure OBS

Install OSC

OSC is the command line program of OBS. You can use thehere, select your own system version and add software source to your own package manager.

Take Fedora 30 as an example

  1. Add software source

Filehttp://download.opensuse.org/repositories/openSUSE:/Tools/Fedora_30/openSUSE:Tools.repoSave to / etc/ yum.repo . D / medium. >Root permission is required.

  1. Install OSC

implementdnf install oscCommand to install OSC.

Configure OBS of openeuler

There are many ways to link the OSC to the OBS of the openeuler extranet

  1. The most basic method is to execute every timeoscAdd parameters when command:-A http://openeuler-build.huawei.com/
  2. Using alias:alias iosc="osc -A http://openeuler-build.huawei.com/"
  3. Modification inhomeThe OSC configuration file in the directory:vi ~/.oscrcAnd write the following:

Register OBS account

openhttp://openeuler-build.huawei.com/, click “sign up” in the upper right corner to register your favorite account.

After registration, go back to the above website. Click “login” in the upper right corner to log in with your new account. The system will automatically create a home project named in the format of “home: user name” when registering.

You need to send email to [email protected] apply.

OSC command

OSC help is a help guide. It’s like the GIT command.

List Existing Content on the Server

osc ls #list projects

osc ls Apache #list packages in a project

osc ls Apache flood #list files of package of a project

Checkout Content

osc co Apache # entire project

osc co Apache flood # a package

osc co Apache flood flood.spec # single file

Update a Working Ddirectory

osc up

osc up [directory]

osc up * # from within a project dir, update all packages

osc up # from within a project dir, update all packages AND check out all newly added packages

Upload Changed Content

osc ci # current dir

osc ci [file1] [file2] # only specific files

osc ci [dir1] [dir2] … # multiple packages

osc ci -m “updated foobar” # specify a commit message

Check the Commit Log

osc log

Show the status (which files have been changed locally)

osc st

osc st [directory]

If an update cannot be merged automatically, a file is in ‘C’ (conflict) state, and conflicts are marked with special lines. After manually resolving the problem, use osc resolved *FILE*.

Mark files to be Added or Removed on the Next Checkin

osc add foo

osc rm foo

Add all New Files in Local Copy and Removes all Disappeared files

osc addremove

Generate a diff to view the changes

osc diff [file]

Show the Build Results of the Package

osc results

osc results [platform]

Show the Log File of a Package

(you need to be inside a package directory)

osc buildlog [platform] [arch]

Build on local machine

osc build [platform] [arch] [specfile] [–clean|–noinit|…]

Enter chroot environment as abuild user, which is convenient for debugging

osc chroot [platform] [arch]

How to create your own project, package

Configure project

Two methods: web operation, command line operation

  • Web page operation:

Click on the top right corner of the OBS home page

My openeuler community engagement Tour

Enter home project, repositories, add from a distribution.

My openeuler community engagement Tour

Fill in the basic configuration as shown in the figure above, and fill in your favorite name in the name column.

After selection, go back to the repositories interface, and you can see the environment as shown in the following figure:

My openeuler community engagement Tour

  1. The first is the Edit button, which allows you to select the compilation schema for the current release
  2. The second is the Add button, which allows you to add separate packages (such as other privately compiled dependent packages) on the distribution standard environment
  3. The third is to download. Click and go to the warehouse of the current environment
  4. The fourth is deletion
  • Command line operation:

Execute command:OSC meta Prj - E [project name], you will see text similar to the following:

My openeuler community engagement Tour

Among them, 1. The repository tag is the warehouse tag, which can be added to add the basic environment at compile time. 2. The path tag is the available package path label, and the distribution package path needs to be added manually. If additional dependencies are needed, they can also be added separately. 3. The arch tag is a compilation architecture, and multiple can be added at the same time.

For example:

`xml

<repository name=”openEuler_selfbuild_BaseOS_beiyong_aarch64″>

<path project=”openEuler:selfbuild:BaseOS” repository=”mainline_standard_aarch64″/>

<path project=” openEuler:selfbuild :BaseOS” repository=”standard_ Aarch64 “/ > / / this is an additional dependency

<arch>aarch64</arch>

< arch > armv7l < / arch > / / this is a multi architecture option

</repository>

`

New package

Enter the project directory:CD [project name]

New package:OSC mkpac [package name]

Enter the package directory and place the downloaded source code in the format of [tar package, all patches, spec files, and other source files]:

My openeuler community engagement Tour

Add the above files to the newly created package:osc add *

My openeuler community engagement Tour

Upload changes to server:osc commit

My openeuler community engagement Tour

Here you can note the brief introduction of this upload:wqSave and exit

Then you can wait on the web page to compile and see the results.

View package status and download package

You can see the current compilation status on the right side of the project and package home page

My openeuler community engagement Tour

  • finishedIndicates the end of the process of compiling links and installation checks on a system platform
  • succeededThe status is compiled successfully
  • failedFor compilation failure, you can click to view the log

You can click_ Compile platform > go to download repository_ After arriving at the compilation repository, the repo source of the project and all packages that have been successfully compiled are obtained.

Update package

Enter the project folder:CD [project name]

Update local code to the latest code:osc up

Enter the package directory and use theosc addCommand to add a new file to the package, modify the spec file and use theosc commitCommand to upload the new version.

A kind of The use of service and the linkage with code cloud

It is divided into two parts

  • Using source services to get git source code directly and compile it into a package
  • By using webhook, the source service is triggered when the GIT repository is pushed, so that OBS can always follow the latest version of GIT repository source code

Get git source code directly by source service and compile it into package

Source services related

Source services is a tool for validating, generating, or modifying sources in a reliable manner. They are designed to be minimal tools and can be combined according to the powerful ideas of classic UNIX design.

The source service is like a function in the system. We can call it by running a script; the script is in the package_ Service file.

Create a package that uses the source service

  1. Create an empty package through the command line tool or web page

My openeuler community engagement Tour

  1. Enter the package directory and create it_ Service: click on the web_ Add file_ , click_ Choose a file_ , and choose the one built locally_ Service file. The command line is created in the package directory_ Service file and upload it to the server.
  2. Ready to edit_ Service file

Editor_ Service file

The most basic_ The service file will look like this:

<services>

<service name=”tar_scm”>

<param name=”scm”>git</param>

<param name=”url”>git://github.com/cs2c-fu/hi.git</param>

</service>

<service name=”recompress” mode=”buildtime”>

<param name=”compression”>xz</param>

<param name=”file”>*.tar</param>

</service>

<service name=”set_version” mode=”buildtime”/>

</services>

The outermost layer isMark, inThe inside is one by oneFunction, andIs the parameter of the function.

In order to achieve“Get git source code directly by source service and compile it into package”This goal,

Our_ Service should be similar to this (please choose the appropriate order according to the specific situation for the following format:

<services>

<service name=”tar_scm”>

<param name=”scm”>git</param>

<param name=”filename”>helloworld</param>

<param name=”url”>git://github.com/cs2c-fu/hi.git</param>

<param name=”versionprefix”>VERSION.git</param>

</service>

<service name=”extract_file”>

<param name=”archive”>.</param>

<param name=”files”>/.spec /.patch</param>

</service>

<service name=”recompress” mode=”buildtime”>

<param name=”compression”>xz</param>

<param name=”file”>*.tar</param>

</service>

<service name=”set_version” mode=”buildtime”/>

</services>

The following describes the required services one by one:

First service:tar_scm

tar_scmThe repository in the link URL will be downloaded and packaged as a tar file. The file package naming format is:

[Name]-[Version].[commit_timestamp].tar

Among them, [commit]_ Timestamp] is the commit hexadecimal timestamp.

Optional parameters:

  • filenameDefine the name of the packaged file, which is git warehouse name by default.
  • versionprefixSet the version format of the packaged file. The default is the current decimal timestamp.

In the official server of OBS,tar_scmDue to its poor performance in space utilization, the service has beenobs_scmtarService replacement, but openeuler’s extranet OBS is not supported yetobs_scmSo here’s the choicetar_scm

See:link

The second service:extract_file

extract_fileFiles can be extracted from the tar package, depending on the file format in the GIT repository.

Generally speaking, we can divide the content needed for packaging into four categories:

  • Source code: files that participate in the compilation process
  • Spec file: a specification file that guides how to package
  • Patch file: modify the difference file of source code
  • source file: files that do not participate in compilation but need to be packaged

aboutGit warehouseIn general, all files will be put in the root directory of the warehouse.

My openeuler community engagement Tour

At this point, we need toSpec file, patch file, source fileExtract it,Source codeThen it will stay in the tar package and wait for the service to compress and package it.

aboutOBS warehouseIn order to facilitate the use of OBS system, people have compressed and packaged the source code.

My openeuler community engagement Tour

At this point, we need toAll documentsExtract and omit the subsequent compression and packaging process.

Parameters:

  • archiveDefine extraction source file format
  • filesDefine extraction file typeNote: there is a top-level directory whose name is unknown, so the file name should start with “* /”

The third service:recompress

recompressThe specified file will be compressed

Parameters:

  • compressionCompression format, optional: none, GZ, bz2, XZ
  • fileCompress content

Fourth service:set_version

The version in the spec file is replaced with obs_ SCM

[Version].[commit_timestamp]

In the spec file, the

helloworld-%{version}.tar.xz

Format positioning source package.

Wait for the compilation to complete

Because the source service is used to obtain the source code, additional process and time are required at compile time.

My openeuler community engagement Tour

When the status is displayed asblockedIndicates that the source service is running. When the source service is finished, the packaging process will start normally.

My reference case:link

Application of source services in actual scene

stayoVirt-SIGIn the group, we use the source service to synchronize the code from git to obs.

First of all, in Git repository, we use:Spec file, patch fileSource code tar package * * format upload and manage the source code.

My openeuler community engagement Tour

The corresponding package is established in the OBS system and defined in the following format_ Service file:

<services>

<service name=”tar_scm”>

<param name=”scm”>git</param>

<param name=”filename”>ioprocess</param>

<param name=”url”>https://gitee.com/openkylin/i…</param>

</service>

<service name=”extract_file”>

<param name=”archive”>.</param>

<param name=”files”>/</param>

</service>

</services>

Since we have set the storage format in Git repository, we only need to download and extract all the files.

After that, the OBS system will help us complete the compilation and packaging.

Using webhook to trigger the source service when it is pushed in Git warehouse

At the time of writing this article, the OBS system does not support webhook in gitee format, so the following is implemented using GitHub repository.

OBS can create a token. When the token is triggered, OBS will run the source service.

By adding the URL and token to the webhook list of GIT repository, the trigger source service can be implemented in Git repository, and then the package version in OBS can be updated.

Specific steps:

Create OBS token of exclusive package:

osc token –create <PROJECT> <PACKAGE>

The command will generate a token that only works for project / package.

  • Using commandsosc tokenYou can view a list of currently valid tokens.
  • Using commandsosc token --deleteThe token can be deleted

Take hugit as an example:

My openeuler community engagement Tour

Open warehouse > setting > webhooks

My openeuler community engagement Tour

Click add webhook at the top left.

My openeuler community engagement Tour

In the payload URL, use:

http://openeuler-build.huawei…; token ID >

Fill in for the format.

Fill in the token secret key in secret, and select trigger type according to requirements to ensure that webhook is in active state.

After that, click add webhook to successfully implement it.

Try to trigger trigger to verify the results.


Add a little helper openeuler, join the openeuler communication group

My openeuler community engagement Tour

More content, please pay attention to openEuler official account.

My openeuler community engagement Tour