Skip to content

[Batcher] Add ability to send batched http requests to runtime #3647

[Batcher] Add ability to send batched http requests to runtime

[Batcher] Add ability to send batched http requests to runtime #3647

Workflow file for this run

# Copyright 2023 The Nuclio Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: CI
on:
pull_request:
branches:
- development
- "[0-9]+.[0-9]+.x"
paths-ignore:
- 'docs/**'
- 'README.md'
- 'README_zh.md'
# Run CI also on push to master
push:
branches:
- master
env:
REPO: quay.io
CACHE_REPO: ghcr.io
REPO_NAME: nuclio
CACHE_REPO_NAME: ${{ github.repository_owner }}
NUCLIO_LABEL: ${{ github.run_number }}
NAMESPACE: nuclio
NUCLIO_GO_TEST_TIMEOUT: "30m"
DOCKER_BUILDKIT: 1
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
cache: true
go-version-file: go.mod
- name: Ensure go test files are build annotated
run: make ensure-test-files-annotated
- name: Lint
run: make lint
check-copyright-license:
name: Check copyright and license
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Check License Lines
run: |
deno run --allow-read https://deno.land/x/[email protected]/main.ts
- name: Instructions For Adding Copyright
if: ${{ failure() }}
run: |
echo "
Please add the following lines to the top of your code as a comment:
/*
Copyright 2023 The Nuclio Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
"
test_short:
name: Test short
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
cache: true
go-version-file: go.mod
- name: Run unit test
run: |
make test-unit
build_nuctl:
name: Build nuctl
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
cache: true
go-version-file: go.mod
- name: Build
run: |
make nuctl
# make nuctl-bin
env:
NUCLIO_NUCTL_CREATE_SYMLINK: false
# TODO: uncomment once a fix for make nuctl-bin is found
# - name: Ensure version
# run: |
# ./nuctl-$NUCLIO_LABEL-linux-amd64 version
build_docker_images:
name: Build docker images
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.CACHE_REPO }}
username: ${{ env.CACHE_REPO_NAME }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Freeing up disk space
run: "${GITHUB_WORKSPACE}/hack/scripts/ci/free-space.sh"
- uses: actions/setup-go@v3
with:
cache: true
go-version-file: go.mod
- name: Build
run: |
make docker-images
env:
NUCLIO_DOCKER_REPO: ${{ env.REPO }}/${{ env.REPO_NAME }}
NUCLIO_CACHE_REPO: ${{ env.CACHE_REPO }}/${{ env.CACHE_REPO_NAME }}
# Clean build leftovers
- name: Post build cleanup
run: docker system prune --force
- name: Save
run: make save-docker-images
- name: Upload
uses: actions/upload-artifact@v3
with:
name: nuclio-docker-images
path: nuclio-docker-images-*.tar.gz
test_k8s_nuctl:
name: Test Kubernetes nuctl
runs-on: ubuntu-latest
needs:
- build_docker_images
steps:
- uses: actions/checkout@v3
- name: Freeing up disk space
run: "${GITHUB_WORKSPACE}/hack/scripts/ci/free-space.sh"
- uses: azure/setup-helm@v3
with:
version: "v3.6.3"
- uses: actions/setup-go@v3
with:
cache: true
go-version-file: go.mod
- uses: manusa/[email protected]
with:
minikube version: "v1.31.2"
kubernetes version: "v1.27.5"
driver: docker
github token: ${{ github.token }}
start args: "--addons registry --addons ingress"
# TODO: run on containerd as well
container runtime: docker
- name: Post minikube setup
run: |
# redirect $(minikube ip):5000 -> localhost:5000
docker run --rm --detach --network=host alpine ash -c "apk add socat && socat TCP-LISTEN:5000,reuseaddr,fork TCP:$(minikube ip):5000"
minikube kubectl -- config view --flatten > kubeconfig_flatten
- name: Fetch nuclio docker images
uses: actions/download-artifact@v3
with:
name: nuclio-docker-images
- name: Load nuclio docker images
run: |
# load nuclio docker images to host docker
make load-docker-images
# activate minikube docker
eval $(minikube -p minikube docker-env)
# load nuclio docker images to minikube
make load-docker-images
rm nuclio-docker-images*.tar.gz
- name: Export env
run: |
echo "NUCTL_EXTERNAL_IP_ADDRESSES=$(minikube ip)" >> $GITHUB_ENV
echo "NUCTL_REGISTRY=localhost:5000" >> $GITHUB_ENV
echo "NUCLIO_DASHBOARD_DEFAULT_ONBUILD_REGISTRY_URL=$REPO" >> $GITHUB_ENV
echo "NUCTL_NAMESPACE=$NAMESPACE" >> $GITHUB_ENV
echo "KUBECONFIG=$(pwd)/kubeconfig_flatten" >> $GITHUB_ENV
echo "NUCLIO_TEST_KUBE_DEFAULT_INGRESS_HOST=nuclio-test-function-host.info" >> $GITHUB_ENV
echo "NUCTL_DEFAULT_SERVICE_TYPE=NodePort" >> $GITHUB_ENV
echo "PULL_POLICY=Never" >> $GITHUB_ENV
- name: Install nuclio helm chart
run: |
minikube kubectl -- create namespace ${NAMESPACE}
cat test/k8s/ci_assets/helm_values.yaml \
| envsubst \
| helm install --debug --wait --namespace ${NAMESPACE} -f - nuclio hack/k8s/helm/nuclio/
- name: Run nuctl k8s tests
run: |
# write function host to /etc/hosts
echo "${NUCTL_EXTERNAL_IP_ADDRESSES} ${NUCLIO_TEST_KUBE_DEFAULT_INGRESS_HOST}" | sudo tee -a /etc/hosts
# run test
make test-k8s-nuctl
- name: Output some logs in case of failure
if: ${{ failure() }}
# add set -x to print commands before executing to make logs reading easier
run: |
set -x
minikube ip
minikube logs
minikube kubectl -- --namespace ${NAMESPACE} logs -l app=nuclio,release=nuclio --tail=-1
minikube kubectl -- --namespace ${NAMESPACE} get all
minikube kubectl -- --namespace ${NAMESPACE} get all -o yaml
minikube kubectl -- --namespace ${NAMESPACE} describe pods
minikube kubectl -- --namespace ${NAMESPACE} get cm
minikube kubectl -- --namespace ${NAMESPACE} get cm -o yaml
minikube kubectl -- --namespace ${NAMESPACE} get secrets
minikube kubectl -- --namespace ${NAMESPACE} get secrets -o yaml
minikube kubectl -- --namespace ${NAMESPACE} get pvc
minikube kubectl -- --namespace ${NAMESPACE} get pv
set +x
test_docker_nuctl:
name: Test Docker nuctl
runs-on: ubuntu-latest
needs:
- build_docker_images
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
cache: true
go-version-file: go.mod
- name: Fetch nuclio docker images
uses: actions/download-artifact@v3
with:
name: nuclio-docker-images
- name: Load nuclio docker images
run: |
make load-docker-images
rm nuclio-docker-images*.tar.gz
- name: Run nuctl docker tests
run: |
make test-docker-nuctl
test_k8s:
name: Test Kubernetes
runs-on: ubuntu-latest
needs:
- build_docker_images
steps:
- uses: actions/checkout@v3
- uses: azure/setup-helm@v3
with:
version: "v3.6.3"
- uses: actions/setup-go@v3
with:
cache: true
go-version-file: go.mod
- uses: manusa/[email protected]
with:
minikube version: "v1.31.2"
kubernetes version: "v1.27.5"
driver: docker
github token: ${{ github.token }}
start args: "--addons registry --addons ingress"
# TODO: run on containerd as well
container runtime: docker
- name: Post minikube setup
run: |
# redirect $(minikube ip):5000 -> localhost:5000
docker run --rm --detach --network=host alpine ash -c "apk add socat && socat TCP-LISTEN:5000,reuseaddr,fork TCP:$(minikube ip):5000"
minikube kubectl -- config view --flatten > kubeconfig_flatten
- name: Fetch nuclio docker images
uses: actions/download-artifact@v3
with:
name: nuclio-docker-images
- name: Load nuclio docker images
run: |
make load-docker-images
rm nuclio-docker-images*.tar.gz
- name: Export env
run: |
echo "NUCLIO_EXTERNAL_IP_ADDRESS=$(minikube ip)" >> $GITHUB_ENV
echo "NUCLIO_TEST_REGISTRY_URL=localhost:5000" >> $GITHUB_ENV
echo "NUCLIO_TEST_KUBECONFIG=$(pwd)/kubeconfig_flatten" >> $GITHUB_ENV
echo "NUCLIO_TEST_KUBE_DEFAULT_INGRESS_HOST=nuclio-test-function-host.info" >> $GITHUB_ENV
- name: Install nuclio helm chart
run: |
# create namespace
minikube kubectl -- create namespace ${NAMESPACE}
# install helm chart
./test/k8s/ci_assets/install_nuclio_crds.sh
- name: Run k8s tests
run: |
# write function host to /etc/hosts
echo "${NUCLIO_EXTERNAL_IP_ADDRESS} ${NUCLIO_TEST_KUBE_DEFAULT_INGRESS_HOST}" | sudo tee -a /etc/hosts
make test-k8s
test_python:
name: Test python
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run python test
run: |
make test-python
test_nodejs:
name: Test NodeJS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run NodeJS test
run: |
make test-nodejs