Skip to content

Continous Integration Tests #3825

Continous Integration Tests

Continous Integration Tests #3825

name: Continous Integration Tests
on:
push:
pull_request:
schedule:
- cron: '23 4 * * 1' # At 04:23 UTC on Mondays.
jobs:
jenkins-master:
name: Jenkins master tests
runs-on: ubuntu-22.04
steps:
-
name: Checkout repository
uses: actions/[email protected]
-
name: Build UBI8 docker image
run: |
./.github/workflows/build-docker-image.sh \
--imagename ods-jenkins-master-ubi8 \
--dockerdir jenkins/master \
--dockerfile Dockerfile.ubi8
jenkins-agent-base:
name: Jenkins agent base tests
runs-on: ubuntu-22.04
steps:
-
name: Checkout repository
uses: actions/[email protected]
- name: Build UBI8 docker image
run: |
./.github/workflows/build-docker-image.sh \
--imagename ods-jenkins-agent-base-ubi8 \
--dockerdir jenkins/agent-base \
--dockerfile Dockerfile.ubi8 \
--build-arg SNYK_DISTRIBUTION_URL="https://github.com/snyk/snyk/releases/download/v1.1097.0/snyk-linux"
- name: Push UBI8 docker image
if: success() && github.repository == 'opendevstack/ods-core' && github.event_name == 'push'
shell: bash
env:
DOCKER_USER: ${{ secrets.DockerHubUser }}
DOCKER_PASS: ${{ secrets.DockerHubPass }}
run: |
./.github/workflows/push-docker-image.sh \
--user "$DOCKER_USER" \
--password "$DOCKER_PASS" \
--imagename ods-jenkins-agent-base-ubi8
sonarqube:
name: SonarQube tests
runs-on: ubuntu-22.04
strategy:
matrix:
version: ['10.8.0'] # 9.9 = LTS
edition: ['developer', 'enterprise']
steps:
-
name: Checkout repository
uses: actions/[email protected]
-
name: Check shell scripts
run: |
shellcheck sonarqube/*.sh
-
name: Run tests
run: |
cd sonarqube && ./test.sh --sq-version=${{ matrix.version }} --sq-edition=${{ matrix.edition }}
nexus:
name: Nexus tests
runs-on: ubuntu-22.04
steps:
-
name: Checkout repository
uses: actions/[email protected]
-
name: Check shell scripts
run: |
shellcheck nexus/*.sh
-
name: Run tests
run: |
cd nexus && ./test.sh
webhook-proxy:
name: Webhook Proxy tests
runs-on: ubuntu-22.04
steps:
-
name: Checkout repository
uses: actions/[email protected]
-
name: Setup Go 1.23
uses: actions/setup-go@v5
with:
go-version: 1.23
-
name: Download goimports
run: |
go install golang.org/x/tools/cmd/goimports@latest
-
name: Download golangci-lint
run: |
curl -sSfL --output /tmp/golangci-lint.sh https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh
cat /tmp/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.60.1
-
name: Run linter
working-directory: jenkins/webhook-proxy
run: |
export PATH=$PATH:$(go env GOPATH)/bin
make lint
-
name: Run tests
working-directory: jenkins/webhook-proxy
run: |
export PATH=$PATH:$(go env GOPATH)/bin
make test
-
name: Build docker image
run: |
./.github/workflows/build-docker-image.sh \
--imagename ods-webhook-proxy \
--dockerdir jenkins/webhook-proxy
create-projects:
name: Create Projects tests
runs-on: ubuntu-22.04
steps:
-
name: Checkout repository
uses: actions/[email protected]
-
name: Check shell scripts
run: |
shellcheck create-projects/*.sh
-
name: Run tests
working-directory: create-projects/tests
run: |
./run.sh
clone-check:
name: Verify clone script requirements
runs-on: ubuntu-22.04
steps:
-
name: Checkout repository
uses: actions/[email protected]
-
name: Check jsl expectations
run: |
ocp-scripts/verify-jsl-expectations.sh
-
name: Check compliant shell scripts
run: |
shellcheck --version
shellcheck ocp-scripts/clone-project.sh
shellcheck ocp-scripts/verify-jsl-expectations.sh
compile-go-tests:
name: Verify Go tests are formatted and can be compiled
runs-on: ubuntu-22.04
steps:
-
name: Checkout repository
uses: actions/[email protected]
-
name: Setup Go 1.18
uses: actions/setup-go@v5
with:
go-version: 1.18
-
name: Verify all Go files are formatted with gofmt
working-directory: tests
run: |
unformatted=$(gofmt -l .)
[ -z "$unformatted" ] && exit 0
echo >&2 "Go files must be formatted with gofmt. Please run:"
for fn in $unformatted; do
echo >&2 "Differences found:"
gofmt -d $fn
echo >&2 " gofmt -w $fn"
done
exit 1
-
name: Verify all Go tests pass linting
uses: golangci/golangci-lint-action@v6
with:
version: v1.49.0
working-directory: tests
args: --timeout=10m
-
name: Verify all Go tests can be compiled
working-directory: tests
run: |
go test -c ./create-projects
go test -c ./ods-verify
# cluster:
# name: Setup and project provisioning tests
# runs-on: ubuntu-22.04
# steps:
# -
# name: GitHub context
# env:
# GITHUB_CONTEXT: ${{ toJson(github) }}
# run: jq . <<< "${GITHUB_CONTEXT}"
# -
# name: Checkout repository
# uses: actions/[email protected]
# with:
# fetch-depth: 0
# path: 'ods-core'
# -
# name: Setup Go 1.13
# uses: actions/[email protected]
# with:
# version: 1.13
# -
# name: Download OpenShift Client
# run: |
# wget https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz
# tar -xzvf openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz
# sudo mv openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit/oc /usr/local/bin/oc
# -
# name: Download Tailor
# run: |
# curl -LO "https://github.com/opendevstack/tailor/releases/download/v0.13.1/tailor-linux-amd64"
# chmod +x tailor-linux-amd64
# sudo mv tailor-linux-amd64 /usr/local/bin/tailor
# -
# name: Tailor version
# run: tailor version
# -
# name: OpenShift client version
# run: oc version
# -
# name: jq version
# run: jq --version
# -
# name: golang version
# run: go version
# -
# name: Docker version
# run: docker --version
# -
# name: Network before changes
# run: ifconfig
# -
# name: Configure docker network and insecure registries
# run: ./ods-core/tests/scripts/apply-docker-settings.sh
# -
# name: Start OC cluster
# run: oc cluster up --base-dir=${HOME}/openshift.local.clusterup --routing-suffix 172.17.0.1.nip.io --public-hostname 172.17.0.1 --enable=centos-imagestreams --enable=persistent-volumes --enable=registry --enable=router
# -
# name: Login into the cluster
# run: oc login -u system:admin
# -
# name: Create test infrastructure
# run: |
# mkdir -p ods-config
# ./ods-core/tests/scripts/recreate-test-infrastructure.sh
# -
# name: Run tests
# run: make -C tests test