Skip to content

Commit b29e6d5

Browse files
committed
Fixed #xxx: Run Skupper integration tests for skupper-router image
1 parent 0e2c88b commit b29e6d5

File tree

5 files changed

+183
-18
lines changed

5 files changed

+183
-18
lines changed
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
name: Test skupper-router main
21+
description: Execute skupper integration testing
22+
23+
inputs:
24+
25+
qdrouterdImage:
26+
required: true
27+
description: Image to use in skupper integration tests
28+
29+
skupperGitRef:
30+
required: false
31+
description: Reference to skupper version
32+
default: "0.8.7"
33+
34+
runs:
35+
using: "composite"
36+
steps:
37+
38+
- name: Get Go cache paths
39+
id: go-cache-paths
40+
run: |
41+
echo "::set-output name=go-build::$(go env GOCACHE)"
42+
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
43+
shell: bash
44+
45+
- name: Install microk8s
46+
run: |
47+
sudo snap install microk8s --classic --channel=1.21/stable
48+
sudo microk8s enable dns ingress storage registry:size=20Gi host-access:ip=10.0.1.1 metallb:10.64.140.43-10.64.140.49
49+
sudo microk8s status --wait-ready
50+
shell: bash
51+
52+
- name: Export microk8s config
53+
if: "${{ always() }}"
54+
run: |
55+
mkdir -p $HOME/.kube
56+
sudo microk8s config > $HOME/.kube/config
57+
shell: bash
58+
59+
- name: Push image into microk8s
60+
run: |
61+
docker tag "${{ inputs.qdrouterdImage }}" localhost:32000/skupper-router:registry
62+
timeout 5m bash -c 'until nc -z localhost 32000; do sleep 1; done' || :
63+
docker push localhost:32000/skupper-router:registry
64+
shell: bash
65+
66+
- name: Checkout Skupper
67+
uses: actions/checkout@v2
68+
with:
69+
repository: 'skupperproject/skupper'
70+
ref: "${{ inputs.skupperGitRef }}"
71+
path: 'skupper'
72+
73+
- name: Restore Go cache
74+
uses: actions/cache@v2
75+
with:
76+
path: |
77+
${{ steps.go-cache-paths.outputs.go-build }}
78+
${{ steps.go-cache-paths.outputs.go-mod }}
79+
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
80+
81+
- name: Compile Skupper
82+
run: |
83+
make all
84+
sudo install skupper /usr/local/bin
85+
working-directory: skupper
86+
shell: bash
87+
88+
- name: Run Skupper integration tests
89+
run: |
90+
export PUBLIC_1_INGRESS_HOST=10.0.1.1
91+
export QDROUTERD_IMAGE=localhost:32000/skupper-router:registry
92+
93+
go test -count=1 -p=1 -timeout=60m -tags=integration -v ./test/integration/...
94+
working-directory: skupper
95+
shell: bash
96+
97+
- name: Dump microk8s log (apiserver)
98+
if: "${{ always() }}"
99+
run: |
100+
sudo journalctl -u snap.microk8s.daemon-apiserver
101+
shell: bash
102+
103+
- name: Dump microk8s log (kubelet)
104+
if: "${{ always() }}"
105+
run: |
106+
sudo journalctl -u snap.microk8s.daemon-kubelet
107+
shell: bash
108+
109+
- name: Dump microk8s log (kubelite)
110+
if: "${{ always() }}"
111+
run: |
112+
sudo journalctl -u snap.microk8s.daemon-kubelite
113+
shell: bash

.github/scripts/image-build.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
. ./.github/scripts/common.sh
21+
22+
# Building the skupper-router image
23+
${DOCKER} build -t ${PROJECT_NAME}:${PROJECT_TAG} -f ./.github/scripts/Dockerfile .
24+
25+
echo "::set-output name=image-tag::${PROJECT_NAME}:${PROJECT_TAG}"
26+

.github/scripts/image.sh renamed to .github/scripts/image-push.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919

2020
. ./.github/scripts/common.sh
2121

22-
# Building the skupper-router image
23-
${DOCKER} build -t ${PROJECT_NAME}:${PROJECT_TAG} -f ./.github/scripts/Dockerfile .
24-
2522
# Pushing only when credentials available
2623
if [[ -n "${DOCKER_USER}" && -n "${DOCKER_PASSWORD}" ]]; then
2724
${DOCKER} login -u ${DOCKER_USER} -p ${DOCKER_PASSWORD} ${DOCKER_REGISTRY}

.github/workflows/image-main.yml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,34 @@
1818
#
1919

2020
name: Publish skupper-router main
21-
on:
22-
workflow_run:
23-
workflows: ["Build"]
24-
branches: [main]
25-
types:
26-
- completed
21+
on: [push, pull_request, workflow_dispatch]
2722
jobs:
2823
build-image:
2924
name: Publish skupper-router image
3025
runs-on: ubuntu-latest
3126
steps:
27+
3228
- uses: actions/checkout@v2
33-
- run: |
34-
# build and publish the main image
29+
30+
- name: build the main image
31+
id: image-build
32+
run: |
3533
. ./.github/scripts/common.sh
36-
./.github/scripts/image.sh
34+
./.github/scripts/image-build.sh
3735
env:
3836
DOCKER_USER: '${{ secrets.DOCKER_USER }}'
3937
DOCKER_PASSWORD: '${{ secrets.DOCKER_PASSWORD }}'
38+
39+
- name: run tests (skupper integration tests)
40+
uses: ./.github/actions/skupper-integration-tests
41+
with:
42+
qdrouterdImage: "${{ steps.image-build.outputs.image-tag }}"
43+
44+
- name: publish the main image
45+
if: ${{ github.ref == 'refs/heads/main' }}
46+
run: |
47+
. ./.github/scripts/common.sh
48+
./.github/scripts/image-push.sh
49+
env:
50+
DOCKER_USER: '${{ secrets.DOCKER_USER }}'
51+
DOCKER_PASSWORD: '${{ secrets.DOCKER_PASSWORD }}'

.github/workflows/image-manual.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ jobs:
3434
name: Build and publish skupper-router image
3535
runs-on: ubuntu-latest
3636
steps:
37-
- run: |
38-
# validate DOCKER_TAG
37+
38+
- name: validate DOCKER_TAG
39+
run: |
3940
[[ ! "${DOCKER_TAG}" =~ ^[a-z0-9][a-z0-9.-]+[a-z0-9]$ ]] && echo "invalid tag - it must begin and end with letter or digit and contains - and ." && exit 1
4041
protected=(latest nightly master)
4142
for ptag in ${protected[@]}; do
@@ -46,14 +47,30 @@ jobs:
4647
done
4748
env:
4849
DOCKER_TAG: '${{github.event.inputs.dockerTag}}'
50+
4951
- uses: actions/checkout@v2
50-
- run: |
51-
# build, run tests and if all worked publish a custom image
52+
53+
- name: build a custom image
54+
id: image-build
55+
run: |
5256
. ./.github/scripts/common.sh
5357
export PROJECT_TAG="${DOCKER_TAG}"
54-
./.github/scripts/image.sh
58+
./.github/scripts/image-build.sh
59+
env:
60+
PROTON_SOURCE_URL: '${{github.event.inputs.protonSourceUrl}}'
61+
DOCKER_TAG: '${{github.event.inputs.dockerTag}}'
62+
63+
- name: run tests (skupper integration tests)
64+
uses: ./.github/actions/skupper-integration-tests
65+
with:
66+
qdrouterdImage: "${{ steps.image-build.outputs.image-tag }}"
67+
68+
- name: publish a custom image
69+
run: |
70+
. ./.github/scripts/common.sh
71+
export PROJECT_TAG="${DOCKER_TAG}"
72+
./.github/scripts/image-push.sh
5573
env:
5674
DOCKER_USER: '${{ secrets.DOCKER_USER }}'
5775
DOCKER_PASSWORD: '${{ secrets.DOCKER_PASSWORD }}'
58-
PROTON_SOURCE_URL: '${{github.event.inputs.protonSourceUrl}}'
5976
DOCKER_TAG: '${{github.event.inputs.dockerTag}}'

0 commit comments

Comments
 (0)