-
Notifications
You must be signed in to change notification settings - Fork 39
Home
Welcome to the test-infra wiki!
Nephio-project uses PROW which is a Kubernetes based CI/CD system. Instance is located at prow.nephio.io Prow jobs are triggered trough GitHub PRs. Prow also provides chat-ops via /foo style commands, and automatic PR merging after it gets reviewed (https://prow.nephio.io/tide-history).
Prow's configuration is split between this repository under prow/config where base and common for all components settings are kept and local configuration file .prow.yaml
placed in root directory of each repository for repository specific configuration (for example lint job may differ for various repos).
To make change in Prow's configuration everyone is welcome to participate in this PR-based workflow. Once PR is reviewed and merged changes are automatically deployed by Prow itself.
Once PR gets submitted it triggers jobs defined in main and/or local configuration, for example spell checker, linter, syntax checker or container image build. Results of those jobs will be shown on PR page and on Prow's UI where you can view various log files or browse artifacts produced by that job if there are any. One of this UI components: 'Spyglass' provides log viewer with keyword highlighting and link to artifact browser.
There are three kinds of jobs:
- presubmit: those are run on PR content before merge, usually those are syntax checkers, linters, security checks
- postsubmit: those are run on merged PR contend, those can be for example container image building jobs
- periodic: those are run periodically regardless of PRs usually for housekeeping repos, applying policy enforcement rules etc.
We're providing test repository where you can discover Prow and test your ideas. If something works there, it will work in production
repositories as well.
In case job fails, for example there's syntax error in proposed code change, just fix it in your fork/branch and it will be automatically picked up. You can also re-trigger failed job using /retest
(that will re-trigger all failed jobs if there's more than one) or /test name-of-my-awesome-job
to trigger a job manually regardless their state.
Prow jobs are executed in containers most frequently trough shell scripts, so based on job definition for example:
- name: nmath-gosec-test
decorate: true
run_if_changed: "^.*.go$"
spec:
containers:
- image: nephio/gotests:7
command:
- make
args:
- gosec
So you can run identical job on your local development environment using image and commands from job definition. For example based on job above, from top level directory of your pulled/forked repo:
$ docker pull nephio/gotests:7
(...)
$ docker run -it -v${PWD}:/go/src nephio/gotests:7 bash
02f3aaf6d094:/go# cd src/
02f3aaf6d094:/go/src# make gosec
gosec ./...
[gosec] 2023/05/22 12:45:39 Including rules: default
[gosec] 2023/05/22 12:45:39 Excluding rules: default
[gosec] 2023/05/22 12:45:39 Import directory: /go/src
[gosec] 2023/05/22 12:45:39 Import directory: /go/src/nmath
[gosec] 2023/05/22 12:45:39 Checking package: nmath
[gosec] 2023/05/22 12:45:39 Checking file: /go/src/nmath/math.go
[gosec] 2023/05/22 12:45:41 Checking package: main
[gosec] 2023/05/22 12:45:41 Checking file: /go/src/main.go
Results:
Summary:
Gosec : 2.15.0
Files : 2
Lines : 25
Nosec : 0
Issues : 0
02f3aaf6d094:/go/src#
For most repositories here resulting artifact will be a container image, those are built every commit and pushed to registry
For the release process, once a point in repository's history is chosen to be a release, from that commit release trough GitHub process is made. Version naming is vX.Y.Z
(actually anything ^v will do for example v0.1) creation of tag (which happens automatically during that process) triggers the build of container image that gets tagged with that release name (vX.Y.Z
) and pushed to registry
- Go to releases page for the repository, in this example we'll use test repo (that's a playground repo, feel free to test it out there yourself!)
- Use 'Draft new release' to create it and create new tag:
- Use 'Target' to point to commit that you want to create tag from:
- Create Release Notes: Note that you now also have to pick previous tag to generate 'diff' for release notes, otherwise it can pick incorrect one when left to default 'automatic' setting
- After publishing the release Prow will pick up the change and it will spawn the job to build your image, head on to Prow UI to check it out. Note that in 'Revision' field it will have your tag name
- In Spyglass log viewer on Prow UI you can check the log output from build process:
- After Prow job is finished, your image will be uploaded to Docker Hub repository:
For more information about Prow please review online documentation or source code Excellent source of information regarding the configuration are:
- annotated config file: here
- annotated plugin config file: here As well as Kubernetes project own configuration repository: here
All questions, suggestions, ideas and contributions are welcomed, you can reach us at:
- SIG Release mailing list here
- Slack here
- Create Issue or PR here on GitHub
- And check out information at Nephio's wiki