Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Bump docker/login-action from 2 to 3 #239

Bump docker/login-action from 2 to 3

Bump docker/login-action from 2 to 3 #239

Workflow file for this run

# Clone the repos
# Spawn the cluster
# Run the make install
# Run the tests
name: Test Incoming Changes
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
env:
REGISTRY: quay.io
TNF_IMAGE_NAME: testnetworkfunction/cnf-certification-test
TNF_IMAGE_TAG: unstable
OCT_IMAGE_NAME: testnetworkfunction/oct
OCT_IMAGE_TAG: latest
TNF_CONTAINER_CLIENT: docker
TNF_NON_INTRUSIVE_ONLY: false
TNF_ALLOW_PREFLIGHT_INSECURE: false
TNF_DISABLE_CONFIG_AUTODISCOVER: false
TNF_CONFIG_DIR: /tmp/tnf/config
TNF_OUTPUT_DIR: /tmp/tnf/output
TNF_SRC_URL: 'https://github.com/${{ github.repository }}'
SMOKE_TESTS_GINKGO_LABELS_FILTER: '!affiliated-certification-container-is-certified-digest && !access-control-security-context && !access-control-namespace-resource-quota && !networking-network-policy-deny-all'
TESTING_CMD_PARAMS: '-n host -i ${REGISTRY}/${TNF_IMAGE_NAME}:${TNF_IMAGE_TAG} -t ${TNF_CONFIG_DIR} -o ${TNF_OUTPUT_DIR}'
TNF_SMOKE_TESTS_LOG_LEVEL: trace
ON_DEMAND_DEBUG_PODS: false
TERM: xterm-color
OPERATOR_IMAGE_NAME: testnetworkfunction/crd-operator-scaling
OPERATOR_IMAGE_TAG: unstable
OPERATOR_LOCAL_TEST_IMAGE_TAG: test
TNF_TEST_NAMESPACE: tnf
jobs:
smoke-tests:
name: Run Smoke Tests
runs-on: ubuntu-22.04
env:
SHELL: /bin/bash
KUBECONFIG: '/home/runner/.kube/config'
PFLT_DOCKERCONFIG: '/home/runner/.docker/config'
steps:
- name: Free Disk Space (Ubuntu)
uses: edcdavid/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Set up Go 1.21
uses: actions/setup-go@v4
with:
go-version: 1.21.1
- name: Disable default go problem matcher
run: echo "::remove-matcher owner=go::"
- name: Write temporary docker file
run: |
mkdir -p /home/runner/.docker
touch ${PFLT_DOCKERCONFIG}
echo '{ "auths": {} }' >> ${PFLT_DOCKERCONFIG}
# Clone all of the repos needed.
# We need the crd-operator-scaling, cnf-certification-test, and cnf-certification-test-partner repos.
- name: Check out crd-operator-scaling code
uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
# Deploy the CRD scaling repo and build it
- name: Build operator and make local docker image
run: make docker-build IMG=${OPERATOR_IMAGE_NAME}:${OPERATOR_LOCAL_TEST_IMAGE_TAG}
- name: Check out `cnf-certification-test-partner`
uses: actions/checkout@v4
with:
repository: test-network-function/cnf-certification-test-partner
path: cnf-certification-test-partner
# Create a Kind cluster for testing the operator
- name: Start the Kind cluster for `local-test-infra`
uses: ./cnf-certification-test-partner/.github/actions/start-k8s-cluster
with:
working_directory: cnf-certification-test-partner
- name: Load local container image into kind nodes so it can be pulled from the operator pod.
run: kind load docker-image ${OPERATOR_IMAGE_NAME}:${OPERATOR_LOCAL_TEST_IMAGE_TAG} ${OPERATOR_IMAGE_NAME}:${OPERATOR_LOCAL_TEST_IMAGE_TAG}
- name: Deploy operator using the local image created in a previous step.
run: make deploy IMG=${OPERATOR_IMAGE_NAME}:${OPERATOR_LOCAL_TEST_IMAGE_TAG}
- name: Wait for the operator's controller to be running
run: oc wait deployment new-pro-controller-manager -n "${TNF_TEST_NAMESPACE}" --for=condition=available --timeout=240s
- name: Show controller's container image
run: oc get pods -n "${TNF_TEST_NAMESPACE}" -o json | jq '.items[] | .spec.containers[] | select(.name == "manager") | .image'
- name: Run Make install to install dependencies
run: make install
- name: Create operator cluster role.
run: make addrole
- name: Deploy operator sample CRs.
run: oc apply -f config/samples --validate=false
- name: Wait for operator's "jack" pods to be running.
run: oc wait deployment jack --for=condition=available --namespace "${TNF_TEST_NAMESPACE}" --timeout=600s
# Run the cnf-certification-test repo as a container
- name: Check out `cnf-certification-test`
uses: actions/checkout@v4
with:
repository: test-network-function/cnf-certification-test
path: cnf-certification-test
- name: Create required TNF config files and directories
run: |
mkdir -p $TNF_CONFIG_DIR $TNF_OUTPUT_DIR
cp cnf-certification-test/*.yml $TNF_CONFIG_DIR
shell: bash
working-directory: cnf-certification-test
- name: Show current resources in the test namespace
run: oc get all -n "${TNF_TEST_NAMESPACE}"
- name: Run Smoke Tests in a TNF container
run: TNF_LOG_LEVEL=${TNF_SMOKE_TESTS_LOG_LEVEL} ./run-tnf-container.sh ${{ env.TESTING_CMD_PARAMS }} -l "${SMOKE_TESTS_GINKGO_LABELS_FILTER}"
working-directory: cnf-certification-test
# Push the new operator image to Quay.io.
# First, we need to tag the local image with the quay.io tag.
- name: (if on main and upstream) Tag local image so it can be pushed to quay.io
if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'test-network-function' }}
run: docker tag ${OPERATOR_IMAGE_NAME}:${OPERATOR_LOCAL_TEST_IMAGE_TAG} ${REGISTRY}/${OPERATOR_IMAGE_NAME}:${OPERATOR_IMAGE_TAG}
- name: (if on main and upstream) Authenticate against Quay.io
if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'test-network-function' }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
# Use a Robot Account to authenticate against Quay.io
# https://docs.quay.io/glossary/robot-accounts.html
username: ${{ secrets.QUAY_ROBOT_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
- name: (if on main and upstream) Push the newly built image to Quay.io
if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'test-network-function' }}
run: docker push ${REGISTRY}/${OPERATOR_IMAGE_NAME}:${OPERATOR_IMAGE_TAG}
- name: Upload container test results as an artifact
uses: actions/upload-artifact@v3
if: always()
with:
name: smoke-tests-container
path: |
${{ env.TNF_OUTPUT_DIR }}/*.xml
${{ env.TNF_OUTPUT_DIR }}/claim.json
${{ env.TNF_OUTPUT_DIR }}/claimjson.js
${{ env.TNF_OUTPUT_DIR }}/results.html
${{ env.TNF_OUTPUT_DIR }}/tnf-execution.log