Skip to content

Commit bcdc2ea

Browse files
authored
Merge branch 'main' into evolve_oidc_logout
2 parents 18f973b + 0fc5b6e commit bcdc2ea

File tree

130 files changed

+7527
-1239
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+7527
-1239
lines changed

.github/actions/smoke-tests/action.yaml

Lines changed: 13 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,32 @@ name: Run Smoke Tests
22
description: Run Smoke Tests for the project
33

44
inputs:
5-
go-md5:
6-
required: true
7-
type: string
8-
base-image-md5:
9-
required: true
10-
type: string
115
k8s-version:
126
description: Kubernetes version to use
137
required: false
148
k8s-timeout:
159
description: Timeout to use
1610
default: 75s
1711
required: false
18-
image:
19-
description: Docker image to use
20-
default: debian
21-
required: false
12+
image-type:
13+
description: Image type to test
14+
required: true
15+
image-name:
16+
description: Docker image name to test
17+
required: true
18+
tag:
19+
description: Docker image tag to test
20+
required: true
2221
test-image:
2322
description: Test Docker image to use
2423
default: gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/test-runner:latest
2524
required: false
2625
marker:
2726
description: Marker to use
2827
required: false
29-
nginx-key:
30-
description: Nginx key to use
31-
required: false
32-
nginx-crt:
33-
description: Nginx cert to use
34-
required: false
3528
azure-ad-secret:
3629
description: Azure Active Directory secret for JWKs
3730
required: false
38-
rhel-license:
39-
description: RHEL license for UBI builds
40-
required: false
41-
gcr-workload-identity-secret:
42-
description: Google Workflow Identity secret
43-
required: false
44-
gcr-service-account-secret:
45-
description: Google Service Account secret
46-
required: false
47-
forked-workflow:
48-
description: Does this workflow full access to repo resources?
49-
required: false
5031

5132
outputs:
5233
test-results-name:
@@ -56,90 +37,24 @@ outputs:
5637
runs:
5738
using: composite
5839
steps:
59-
- name: Fetch Cached Artifacts
60-
uses: actions/cache@v3
61-
with:
62-
path: ${{ github.workspace }}/dist
63-
key: nginx-ingress-${{ inputs.go-md5 }}
64-
65-
- name: Ingress type
66-
id: ingress-type
67-
run: |
68-
echo "name=nginx${{ contains(inputs.image, 'plus') && '-plus' || '' }}-ingress" >> $GITHUB_OUTPUT
69-
echo "tag=${{ inputs.image }}${{ contains(inputs.marker, 'dos') && '-dos' || '' }}${{ contains(inputs.marker, 'appprotect') && '-nap' || '' }}-${{ github.sha }}" >> $GITHUB_OUTPUT
70-
echo "modules=${{ contains(inputs.marker, 'appprotect') && 'waf' || '' }}${{ contains(inputs.marker, 'dos') && 'dos' || '' }}" >> $GITHUB_OUTPUT
71-
shell: bash
72-
73-
- name: Docker Buildx
74-
uses: docker/setup-buildx-action@v2
75-
76-
- name: Authenticate to Google Cloud
77-
id: auth
78-
uses: google-github-actions/auth@v2
79-
with:
80-
token_format: access_token
81-
workload_identity_provider: ${{ inputs.gcr-workload-identity-secret }}
82-
service_account: ${{ inputs.gcr-service-account-secret }}
83-
if: ${{ inputs.forked-workflow == 'false' }}
84-
85-
- name: Login to GCR
86-
uses: docker/login-action@v3
87-
with:
88-
registry: gcr.io
89-
username: oauth2accesstoken
90-
password: ${{ steps.auth.outputs.access_token }}
91-
if: ${{ inputs.forked-workflow == 'false' }}
92-
93-
- name: Build ${{ inputs.image }} Container
94-
uses: docker/build-push-action@v3
95-
with:
96-
file: build/Dockerfile
97-
context: "."
98-
cache-from: type=gha,scope=${{ inputs.image }}${{ contains(inputs.marker, 'dos') && '-dos' || '' }}${{ contains(inputs.marker, 'appprotect') && '-nap' || '' }}
99-
target: goreleaser${{ inputs.forked-workflow == 'false' && '-prebuilt' || '' }}
100-
tags: "docker.io/nginx/${{ steps.ingress-type.outputs.name }}:${{ steps.ingress-type.outputs.tag }}"
101-
load: true
102-
pull: true
103-
build-args: |
104-
BUILD_OS=${{ inputs.image }}
105-
PREBUILT_BASE_IMG=gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/nginx-ic-base/${{ contains(inputs.image, 'plus') && 'plus' || 'oss' }}:${{ inputs.base-image-md5 }}-${{ inputs.image }}${{ contains(inputs.marker, 'appprotect') && '-waf' || '' }}${{ contains(inputs.marker, 'dos') && '-dos' || '' }}
106-
IC_VERSION=CI
107-
${{ steps.ingress-type.outputs.modules != '' && format('NAP_MODULES={0}', steps.ingress-type.outputs.modules) || '' }}
108-
${{ contains(inputs.marker, 'appprotect') && 'DEBIAN_VERSION=buster-slim' || '' }}
109-
secrets: |
110-
${{ contains(inputs.image, 'plus') && format('"nginx-repo.crt={0}"', inputs.nginx-crt) || '' }}
111-
${{ contains(inputs.image, 'plus') && format('"nginx-repo.key={0}"', inputs.nginx-key) || '' }}
112-
${{ contains(inputs.image, 'ubi') && format('"rhel_license={0}"', inputs.rhel-license) || '' }}
113-
11440
- name: Deploy Kubernetes
11541
id: k8s
11642
run: |
11743
make -f tests/Makefile create-kind-cluster K8S_CLUSTER_NAME=${{ github.run_id }} K8S_CLUSTER_VERSION=${{ inputs.k8s-version }} K8S_TIMEOUT=${{ inputs.k8s-timeout }}
118-
make -f tests/Makefile image-load PREFIX=nginx/${{ steps.ingress-type.outputs.name }} TAG=${{ steps.ingress-type.outputs.tag }} K8S_CLUSTER_NAME=${{ github.run_id }}
44+
make -f tests/Makefile image-load REGISTRY="" PREFIX=${{ inputs.image-name }} TAG=${{ inputs.tag }} K8S_CLUSTER_NAME=${{ github.run_id }}
11945
marker="${{ inputs.marker }}"
12046
nospaces="${marker// /_}"
12147
sanitized_marker="${nospaces//\'/}"
12248
name="${sanitized_marker:-${{ inputs.k8s-version }}}"
12349
echo "cluster_ip=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${{ github.run_id }}-control-plane)" >> $GITHUB_OUTPUT
124-
echo "cluster=$(echo nginx-${{ inputs.image }}-$name)" >> $GITHUB_OUTPUT
50+
echo "cluster=$(echo nginx-${{ inputs.image-type }}-$name)" >> $GITHUB_OUTPUT
12551
shell: bash
12652

12753
- name: Setup Kubeconfig
12854
run: |
12955
sed -i 's|server:.*|server: https://${{ steps.k8s.outputs.cluster_ip }}:6443|' ~/.kube/kind/config
13056
shell: bash
13157

132-
- name: Build Test-Runner Container
133-
uses: docker/build-push-action@v3
134-
with:
135-
file: tests/Dockerfile
136-
context: "."
137-
cache-from: type=gha,scope=test-runner
138-
tags: ${{ inputs.test-image }}
139-
pull: true
140-
load: true
141-
if: ${{ inputs.forked-workflow == 'true' }}
142-
14358
- name: Run Smoke Tests
14459
run: |
14560
touch tests-${{ steps.k8s.outputs.cluster }}.html
@@ -149,9 +64,9 @@ runs:
14964
-v ${{ github.workspace }}/tests:/workspace/tests \
15065
-v ~/.kube/kind/config:/root/.kube/config ${{ inputs.test-image }} \
15166
--context=kind-${{ github.run_id }} \
152-
--image=docker.io/nginx/${{ steps.ingress-type.outputs.name }}:${{ steps.ingress-type.outputs.tag }} \
67+
--image=${{ inputs.image-name }}:${{ inputs.tag }} \
15368
--image-pull-policy=Never \
154-
--ic-type=${{ steps.ingress-type.outputs.name }} \
69+
--ic-type=nginx${{ contains(inputs.image-type, 'plus') && '-plus' || '' }}-ingress \
15570
--service=nodeport --node-ip=${{ steps.k8s.outputs.cluster_ip }} \
15671
--html=tests-${{ steps.k8s.outputs.cluster }}.html \
15772
--self-contained-html \

.github/data/version.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
IC_VERSION=3.5.0
2-
HELM_CHART_VERSION=1.2.0
1+
IC_VERSION=3.6.0
2+
HELM_CHART_VERSION=1.3.0

.github/scripts/release-version-update.sh

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,40 +28,43 @@ FILE_TO_UPDATE_HELM_CHART_VERSION=(
2828
)
2929

3030
usage() {
31-
echo "Usage: $0 <ic_version> <helm_chart_version>"
31+
echo "Usage: $0 <current_ic_version> <current_helm_chart_version> <new_ic_version> <new_helm_chart_version>"
3232
exit 1
3333
}
3434

35-
if ! command -v yq > /dev/null 2>&1; then
36-
echo "ERROR: yq command not found in \$PATH, cannot continue, exiting..."
37-
exit 2
35+
current_ic_version=$1
36+
current_helm_chart_version=$2
37+
new_ic_version=$3
38+
new_helm_chart_version=$4
39+
40+
if [ -z "${current_ic_version}" ]; then
41+
usage
3842
fi
3943

40-
ic_version=$1
41-
helm_chart_version=$2
44+
if [ -z "${current_helm_chart_version}" ]; then
45+
usage
46+
fi
4247

43-
if [ -z "${ic_version}" ]; then
48+
if [ -z "${new_ic_version}" ]; then
4449
usage
4550
fi
4651

47-
if [ -z "${helm_chart_version}" ]; then
52+
if [ -z "${new_helm_chart_version}" ]; then
4853
usage
4954
fi
5055

51-
current_ic_version=$(yq '.appVersion' <"${HELM_CHART_PATH}/Chart.yaml")
5256
escaped_current_ic_version=$(printf '%s' "$current_ic_version" | sed -e 's/\./\\./g');
53-
current_helm_chart_version=$(yq '.version' <"${HELM_CHART_PATH}/Chart.yaml")
5457
escaped_current_helm_chart_version=$(printf '%s' "$current_helm_chart_version" | sed -e 's/\./\\./g');
5558

5659
echo "Updating versions: "
57-
echo "ic_version: ${current_ic_version} -> ${ic_version}"
58-
echo "helm_chart_version: ${current_helm_chart_version} -> ${helm_chart_version}"
60+
echo "ic_version: ${current_ic_version} -> ${new_ic_version}"
61+
echo "helm_chart_version: ${current_helm_chart_version} -> ${new_helm_chart_version}"
5962

60-
regex_ic="s#$escaped_current_ic_version#$ic_version#g"
61-
regex_helm="s#$escaped_current_helm_chart_version#$helm_chart_version#g"
63+
regex_ic="s#$escaped_current_ic_version#$new_ic_version#g"
64+
regex_helm="s#$escaped_current_helm_chart_version#$new_helm_chart_version#g"
6265

6366
mv "${HELM_CHART_PATH}/values.schema.json" "${TMPDIR}/"
64-
jq --arg version "${ic_version}" \
67+
jq --arg version "${new_ic_version}" \
6568
'.properties.controller.properties.image.properties.tag.default = $version | .properties.controller.properties.image.properties.tag.examples[0] = $version | .properties.controller.examples[0].image.tag = $version | .properties.controller.properties.image.examples[0].tag = $version | .examples[0].controller.image.tag = $version' \
6669
${TMPDIR}/values.schema.json \
6770
> "${HELM_CHART_PATH}/values.schema.json"

.github/scripts/variables.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env bash
2+
3+
if [ "$1" = "" ]; then
4+
echo "ERROR: paramater needed"
5+
exit 2
6+
fi
7+
8+
INPUT=$1
9+
ROOTDIR=$(git rev-parse --show-toplevel || echo ".")
10+
if [ "$PWD" != "$ROOTDIR" ]; then
11+
# shellcheck disable=SC2164
12+
cd "$ROOTDIR";
13+
fi
14+
15+
get_docker_md5() {
16+
docker_md5=$(find build .github/data/version.txt -type f ! -name "*.md" -exec md5sum {} + | LC_ALL=C sort | md5sum | awk '{ print $1 }')
17+
echo "${docker_md5:0:8}"
18+
}
19+
20+
get_go_code_md5() {
21+
find . -type f \( -name "*.go" -o -name go.mod -o -name go.sum -o -name "*.tmpl" -o -name "version.txt" \) -not -path "./docs*" -exec md5sum {} + | LC_ALL=C sort | md5sum | awk '{ print $1 }'
22+
}
23+
24+
get_tests_md5() {
25+
find tests perf-tests .github/data/version.txt -type f -exec md5sum {} + | LC_ALL=C sort | md5sum | awk '{ print $1 }'
26+
}
27+
28+
get_chart_md5() {
29+
find charts .github/data/version.txt -type f -exec md5sum {} + | LC_ALL=C sort | md5sum | awk '{ print $1 }'
30+
}
31+
32+
get_actions_md5() {
33+
find .github .github/data/version.txt -type f -exec md5sum {} + | LC_ALL=C sort | md5sum | awk '{ print $1 }'
34+
}
35+
36+
get_build_tag() {
37+
echo "$(get_docker_md5) $(get_go_code_md5)" | md5sum | awk '{ print $1 }'
38+
}
39+
40+
get_stable_tag() {
41+
echo "$(get_build_tag) $(get_tests_md5) $(get_chart_md5) $(get_actions_md5)" | md5sum | awk '{ print $1 }'
42+
}
43+
44+
case $INPUT in
45+
docker_md5)
46+
echo "docker_md5=$(get_docker_md5)"
47+
;;
48+
49+
go_code_md5)
50+
echo "go_code_md5=$(get_go_code_md5)"
51+
;;
52+
53+
build_tag)
54+
echo "build_tag=$(get_build_tag)"
55+
;;
56+
57+
stable_tag)
58+
echo "stable_tag=$(get_stable_tag)"
59+
;;
60+
61+
*)
62+
echo "ERROR: option not found"
63+
exit 2
64+
;;
65+
esac

0 commit comments

Comments
 (0)