Pulp CI #4131
This file contains hidden or 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
| name: Pulp CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '*' | |
| workflow_dispatch: | |
| pull_request: | |
| branches: | |
| - main | |
| schedule: | |
| # * is a special character in YAML so you have to quote this string | |
| # runs at 3:00 UTC daily | |
| - cron: '00 3 * * *' | |
| env: | |
| COLORTERM: 'yes' | |
| TERM: 'xterm-256color' | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| # by default, it uses a depth of 1 | |
| # this fetches all history so that we can read each commit | |
| fetch-depth: 0 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Setup Go environment | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: 'go.mod' | |
| cache: false | |
| - name: Check commit message | |
| if: github.event_name == 'pull_request' | |
| env: | |
| GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }} | |
| run: | | |
| echo ::group::REQUESTS | |
| pip install pygithub | |
| echo ::endgroup:: | |
| for sha in $(curl $GITHUB_CONTEXT | jq '.[].sha' | sed 's/"//g') | |
| do | |
| python .ci/scripts/validate_commit_message.py $sha | |
| VALUE=$? | |
| if [ "$VALUE" -gt 0 ]; then | |
| exit $VALUE | |
| fi | |
| done | |
| shell: bash | |
| - name: Check code format | |
| run: | | |
| make tidy fmt vet | |
| shell: bash | |
| docs: | |
| # The workflow tag and the pulpdocs_ref must match. | |
| uses: "pulp/pulp-docs/.github/workflows/docs-ci.yml@main" | |
| with: | |
| pulpdocs_ref: "main" | |
| bundle: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check if bundle files are updated | |
| run: | | |
| .ci/scripts/bundle_check.sh | |
| shell: bash | |
| upgrade: | |
| uses: "./.github/workflows/upgrade.yml" | |
| two-deployments: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Go environment | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: 'go.mod' | |
| cache: false | |
| - name: Install kind | |
| run: .ci/scripts/kind_with_registry.sh v1.31.6 | |
| - name: Install OLM | |
| run: | | |
| make sdkbin OPERATOR_SDK_VERSION=v1.31.0 LOCALBIN=/tmp | |
| /tmp/operator-sdk olm install --version v0.31.0 | |
| shell: bash | |
| - uses: actions/checkout@v4 | |
| - name: Install Pulp CRD | |
| run: make install | |
| - name: Build operator image | |
| run: make docker-build docker-push IMG=localhost:5001/pulp-operator:dev | |
| - name: Build bundle image | |
| run: make bundle bundle-build bundle-push BUNDLE_IMG=localhost:5001/pulp-operator-bundle:testing IMG=localhost:5001/pulp-operator:dev | |
| - name: Install the operator | |
| run: /tmp/operator-sdk run bundle --skip-tls localhost:5001/pulp-operator-bundle:testing | |
| - name: Deploy example-pulp and test-pulp | |
| run: | | |
| kubectl apply -f config/samples/simple-with-reduced-migration-cpu.yaml | |
| kubectl apply -f config/samples/simple-test.yaml | |
| - name: Check and wait for example-pulp deployment | |
| run: kubectl wait --for condition=Pulp-Operator-Finished-Execution pulp/example-pulp --timeout=600s | |
| - name: Check and wait for test-pulp deployment | |
| run: kubectl wait --for condition=Pulp-Operator-Finished-Execution pulp/test-pulp --timeout=600s | |
| - name: Logs | |
| if: always() | |
| run: .github/workflows/scripts/show_logs.sh --kind | |
| - name: OLM Logs | |
| if: always() | |
| run: | | |
| echo ::group::SUB | |
| kubectl get sub -oyaml -A | |
| echo ::endgroup:: | |
| echo ::group::InstallPlan | |
| kubectl get ip -A -oyaml | |
| echo ::endgroup:: | |
| echo ::group::PODS | |
| kubectl -nolm get pods | |
| kubectl get pods -A | |
| echo ::endgroup:: | |
| echo ::group::CATALOG-OPERATOR-LOGS | |
| kubectl -nolm logs deployment/catalog-operator | |
| echo ::endgroup:: | |
| echo ::group::OLM-OPERATOR-LOGS | |
| kubectl -nolm logs deployment/olm-operator | |
| echo ::endgroup:: | |
| echo ::group::CATALOGSOURCE | |
| kubectl get catalogsource -oyaml -A | |
| echo ::endgroup:: | |
| echo ::group::CATALOGSOURCE-POD-LOGS | |
| kubectl -ndefault logs localhost-5001-pulp-operator-bundle-testing | |
| kubectl -ndefault describe pod/localhost-5001-pulp-operator-bundle-testing | |
| echo ::endgroup:: | |
| echo ::group::CSV | |
| kubectl get csv -A -oyaml | |
| echo ::endgroup:: | |
| shell: bash | |
| envtest: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Go environment | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: 'go.mod' | |
| cache: false | |
| - name: Check code format and generate manifests | |
| run: | | |
| make test | |
| shell: bash | |
| helm: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/pre-reqs | |
| with: | |
| ingress-type: nodeport | |
| - name: Build operator container and install CRDs | |
| run: | | |
| make docker-build install IMG=localhost/pulp-operator:devel | |
| - name: Create pulp-operator namespace | |
| run: | | |
| kubectl create ns pulp-operator-system | |
| kubectl config set-context --current --namespace=pulp-operator-system | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: pulp/pulp-k8s-resources | |
| ref: main | |
| - name: Install helm chart from source | |
| run: | | |
| helm install --skip-crds --set namespace=pulp-operator-system --set image=localhost/pulp-operator:devel pulp helm-charts/ | |
| - uses: actions/checkout@v4 | |
| - name: Create Pulp Operator CR | |
| run: | | |
| kubectl apply -f .ci/assets/kubernetes/pulp-admin-password.secret.yaml | |
| kubectl apply -f config/samples/simple.yaml | |
| - name: Check and wait pulp-operator deploy | |
| run: | | |
| kubectl wait --for=condition=Ready $(kubectl get pod -l app.kubernetes.io/component=operator -oname) | |
| kubectl logs -f -l app.kubernetes.io/component=operator -c manager & | |
| kubectl wait --for condition=Pulp-Operator-Finished-Execution pulp/example-pulp --timeout=900s | |
| - name: Test all components | |
| run: | | |
| .ci/scripts/pulp_tests.sh -m | |
| shell: bash | |
| env: | |
| PY_COLORS: '1' | |
| - name: Logs | |
| if: always() | |
| run: | | |
| .github/workflows/scripts/show_logs.sh | |
| helm list | |
| containerized: | |
| runs-on: ubuntu-latest | |
| if: github.event_name != 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/pre-reqs | |
| with: | |
| ingress-type: nodeport | |
| - name: Deploy pulp-operator to K8s | |
| run: | | |
| make docker-build deploy | |
| kubectl get namespace | |
| kubectl config set-context --current --namespace=pulp-operator-system | |
| kubectl apply -f config/samples/simple.yaml | |
| shell: bash | |
| - name: Check and wait pulp-operator deploy | |
| run: | | |
| journalctl --unit=pulp-operator -f & | |
| kubectl logs -f -l app.kubernetes.io/component=operator -c manager & | |
| kubectl wait --for condition=Pulp-Operator-Finished-Execution pulp/example-pulp --timeout=900s | |
| shell: bash | |
| - name: KubeLinter | |
| if: github.event_name == 'pull_request' | |
| run: .ci/scripts/kubelinter.sh | |
| - name: Test all components | |
| run: | | |
| .ci/scripts/pulp_tests.sh -m | |
| shell: bash | |
| env: | |
| PY_COLORS: '1' | |
| - name: Logs | |
| if: always() | |
| run: .github/workflows/scripts/show_logs.sh | |
| components: | |
| uses: "./.github/workflows/components.yml" | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: [containerized, components] | |
| if: | | |
| github.event_name != 'pull_request' && | |
| github.repository_owner == 'pulp' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/pre-reqs | |
| with: | |
| deploy: true | |
| - name: Quay login | |
| env: | |
| QUAY_BOT_PASSWORD: ${{ secrets.QUAY_BOT_PASSWORD }} | |
| QUAY_BOT_USERNAME: pulp+github | |
| run: echo "$QUAY_BOT_PASSWORD" | docker login -u "$QUAY_BOT_USERNAME" --password-stdin quay.io | |
| - name: Build and Push images | |
| run: | | |
| if [ "$GITHUB_EVENT_NAME" = "schedule" ]; then | |
| export IMG=quay.io/pulp/pulp-operator:nightly | |
| export CATALOG_IMG=quay.io/pulp/pulp-operator-catalog:nightly | |
| export BUNDLE_IMG=quay.io/pulp/pulp-operator-bundle:nightly | |
| elif [ "$GITHUB_EVENT_NAME" != "push" ] || [[ ! "$GITHUB_REF" =~ ^refs/tags/ ]]; then | |
| export VERSION=$(awk '/^VERSION \?= / {print $3}' Makefile)-dev | |
| fi | |
| make docker-buildx bundle-build bundle-push catalog-build catalog-push | |
| shell: bash |