-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into mysql_ssl_connection
- Loading branch information
Showing
32 changed files
with
377 additions
and
366 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
--- | ||
name: feature tests | ||
|
||
# About security when running the tests and NOT exposing | ||
# the secrets to externals. Currently Github Actions does | ||
# NOT expose the secrets if the branch is coming from a forked | ||
# repository. | ||
# See: https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/ | ||
# See: https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions | ||
# | ||
# An alternate would be to set, pull_request_target but this takes the CI code | ||
# from master removing the ability to change the code in a PR easily. | ||
# | ||
# Aditionally, since 2021 pull requests from new contributors will not | ||
# trigger workflows automatically but will wait for approval from somebody | ||
# with write access. | ||
# See: https://docs.github.com/en/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks | ||
on: | ||
pull_request: | ||
branches: [master] | ||
|
||
env: | ||
SOURCE: /usr/src/rmt-server | ||
SCC_USERNAME: ${{ secrets.SCC_USERNAME }} | ||
SCC_PASSWORD: ${{ secrets.SCC_PASSWORD }} | ||
SYSTEM_UUID: ${{ secrets.SYSTEM_UUID }} | ||
|
||
# Within containters Github Actions does create a bridged network exposing | ||
# the service named after its label | ||
MYSQL_HOST: mysql | ||
|
||
jobs: | ||
feature-tests: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: /usr/src/rmt-server | ||
container: | ||
image: registry.opensuse.org/systemsmanagement/scc/containers/15.5/rmt-ci-container:latest | ||
options: --user root | ||
services: | ||
mysql: | ||
image: registry.suse.com/suse/mariadb:10.6 | ||
env: | ||
MYSQL_DATABASE: rmt_features | ||
MYSQL_USER: rmt | ||
MYSQL_PASSWORD: rmt | ||
MYSQL_ROOT_PASSWORD: root | ||
ports: | ||
- 3306:3306 | ||
options: >- | ||
--health-cmd="mysqladmin ping" | ||
--health-interval=10s | ||
--health-timeout=5s | ||
--health-retries=3 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: move source to /usr/src/rmt-server | ||
run: | | ||
[ -d $SOURCE ] && rm -r $SOURCE | ||
cp -r $GITHUB_WORKSPACE $SOURCE | ||
- name: build RPM package | ||
run: | | ||
bash ci/rmt-build-rpm | ||
- name: gather RPM build artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: rmt-server-rpms | ||
path: ${{ env.SOURCE }}/tmp/artifacts/*.rpm | ||
|
||
- name: configure RMT to run feature tests | ||
run: | | ||
bash ci/rmt-configure | ||
- name: install test dependencies | ||
run: | | ||
bundle install | ||
- name: run feature tests | ||
run: | | ||
bash ci/rmt-run-feature-tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
update-ci-container: | ||
filters: | ||
event: push | ||
steps: | ||
- trigger_services: | ||
project: systemsmanagement:SCC:containers | ||
package: rmt-ci-container | ||
- rebuild_package: | ||
project: systemsmanagement:SCC:containers | ||
package: rmt-ci-container |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!BuildTag: rmt-ci-container | ||
#!UseOBSRepositories | ||
FROM opensuse/leap:15.5 | ||
|
||
RUN zypper --non-interactive in make chrpath fdupes gcc libcurl-devel libffi-devel libmysqlclient-devel \ | ||
libxml2-devel libxslt-devel nodejs sqlite-devel ruby2.5-rubygem-ronn \ | ||
rpmbuild systemd gzip tar bzip2 vim curl wget ruby2.5 ruby2.5-devel \ | ||
ruby2.5-rubygem-bundler | ||
|
||
# Set default bundler to the required version. This way we can easily update ruby in case required | ||
RUN update-alternatives --install /usr/bin/bundle bundle /usr/bin/bundle.ruby2.5 5 && \ | ||
update-alternatives --install /usr/bin/bundler bundler /usr/bin/bundler.ruby2.5 5 | ||
|
||
RUN mkdir /usr/src/rmt-server | ||
WORKDIR /usr/src/rmt-server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
## RMT CI setup | ||
|
||
Our CI setup runs the following steps: | ||
|
||
### Lint and unit tests | ||
|
||
workflow definition: [.github/workflows/lint-unit.yml](https://github.com/SUSE/rmt/blob/master/.github/workflows/lint-unit.yml) | ||
|
||
This workflow runs rubocop to check if the source is well formated and afterwards unit tests and engine unit tests. At last it checks | ||
if version in RMT and the rpm spec file matches. | ||
|
||
**Running it locally** | ||
|
||
There is no special mechanism needed to run these steps locally. Check the workflow for hints how to run unit tests | ||
|
||
### CLI feature tests | ||
|
||
workflow definition: [.github/workflows/features.yml](https://github.com/SUSE/rmt/blob/master/.github/workflows/features.yml) | ||
|
||
This workflow runs our simple CLI feature tests und build the rpm beforehand to see the system working with an installed RMT rpm. | ||
|
||
**Running it locally** | ||
|
||
To run feature tests locally, you need: | ||
|
||
- A checkout of RMT | ||
- A running mysql database | ||
- Proxy credentials to synchronize product information with SCC | ||
|
||
``` | ||
# Fetch the CI container | ||
$ export IMAGE="registry.opensuse.org/systemsmanagement/scc/containers/15.5/rmt-ci-container:latest" | ||
# Build RMT rpms with the CI container the resulting rpms are in tmp/artifacts/ | ||
$ docker run --rm -it -v $(pwd):/usr/src/rmt-server $IMAGE 'ci/rmt-build-rpm' | ||
# Run feature tests in the CI container | ||
# Note: Running --network=host isn't stricly required if you setup mysql access otherwise | ||
$ docker run --rm -it -v $(pwd):/usr/src/rmt-server --network=host $IMAGE bash -c 'ci/rmt-build-rpm && ci/rmt-configure && ci/rmt-run-feature-tests' | ||
``` | ||
|
||
### The CI container | ||
|
||
Our CI container is built here: https://build.opensuse.org/package/show/systemsmanagement:SCC:containers/rmt-ci-container | ||
|
||
On push to Github master the rebuilt of the container is triggered |
Oops, something went wrong.