1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-14 11:57:51 +00:00

scripts: copy prow integration from master

Copy all test-infra scripts and cloudbuild.yaml from master.

Also cherry-pick the required poll-image Makefile target.

(copied from commit a08fb66fa7)
This commit is contained in:
Markus Lehtonen 2020-10-21 16:50:22 +03:00
parent d2bfee21cd
commit 6249bfc5cb
8 changed files with 93 additions and 0 deletions

View file

@ -104,6 +104,18 @@ push:
$(IMAGE_PUSH_CMD) $(IMAGE_TAG)
for tag in $(IMAGE_EXTRA_TAGS); do $(IMAGE_PUSH_CMD) $$tag; done
poll-image:
set -e; \
image=$(IMAGE_REPO):$(IMAGE_TAG_NAME); \
base_url=`echo $(IMAGE_REPO) | sed -e s'!\([^/]*\)!\1/v2!'`; \
errors=`curl -fsS -X GET https://$$base_url/manifests/$(IMAGE_TAG_NAME)|jq .errors`; \
if [ "$$errors" = "null" ]; then \
echo Image $$image found; \
else \
echo Image $$image not found; \
exit 1; \
fi;
site-build:
@mkdir -p docs/vendor/bundle
$(SITE_BUILD_CMD) sh -c "bundle install && jekyll build $(JEKYLL_OPTS)"

12
cloudbuild.yaml Normal file
View file

@ -0,0 +1,12 @@
steps:
- name: gcr.io/k8s-testimages/gcb-docker-gcloud:v20200824-5d057db
entrypoint: scripts/test-infra/push-image.sh
env:
- IMAGE_REGISTRY=gcr.io/$PROJECT_ID
- _GIT_TAG=$_GIT_TAG
- IMAGE_EXTRA_TAG_NAMES=$_PULL_BASE_REF
substitutions:
_GIT_TAG: '0.0.0'
_PULL_BASE_REF: 'master'
options:
substitution_option: ALLOW_LOOSE

View file

@ -0,0 +1,11 @@
#!/bin/bash -e
# Pre-create output directory with all write access. The Jekyll docker image is
# stupid enough to do all sorts of uid/gid/chown magic making build fail for
# root user. In prow we run as root because of DIND.
_outdir="docs/_site"
mkdir -p "$_outdir"
chmod a+rwx "$_outdir"
# Build docs
make site-build

View file

@ -0,0 +1,3 @@
#!/bin/bash -e
make image

3
scripts/test-infra/build.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash -e
make build

View file

@ -0,0 +1,9 @@
#!/bin/bash -e
# Override VERSION if _GIT_TAG is specified. Strip 10 first characters
# ('vYYYYMMDD-') from _GIT_TAG in order to get a reproducible version and
# container image tag
VERSION_OVERRIDE=${_GIT_TAG+VERSION=${_GIT_TAG:10}}
make image $VERSION_OVERRIDE
make push $VERSION_OVERRIDE

34
scripts/test-infra/test-e2e.sh Executable file
View file

@ -0,0 +1,34 @@
#!/bin/bash -e
# Install deps
curl -o $HOME/bin/aws-iam-authenticator --create-dirs https://amazon-eks.s3-us-west-2.amazonaws.com/1.10.3/2018-07-26/bin/linux/amd64/aws-iam-authenticator
chmod a+x $HOME/bin/aws-iam-authenticator
export PATH=$PATH:$HOME/bin
# Configure environment
export KUBECONFIG=`pwd`/kubeconfig
export E2E_TEST_CONFIG=`pwd`/e2e-test-config
echo "$KUBECONFIG_DATA" > "$KUBECONFIG"
echo "$E2E_TEST_CONFIG_DATA" > "$E2E_TEST_CONFIG"
# Wait for the image to be built and published
i=1
while true; do
if make poll-image; then
break
elif [ $i -ge 10 ]; then
"ERROR: too many tries when polling for image"
exit 1
fi
sleep 60
i=$(( $i + 1 ))
done
# Configure environment and run tests
make e2e-test

9
scripts/test-infra/verify.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/bash -e
# Install deps
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.30.0
export PATH=$PATH:$(go env GOPATH)/bin
# Run verify steps
make gofmt-verify
make ci-lint