Skip to content

Commit

Permalink
add harbor e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
airycanon committed Aug 26, 2024
1 parent 6b6c194 commit 098dd9e
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 22 deletions.
67 changes: 46 additions & 21 deletions .build/build-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,40 @@ spec:
This workspace is shared among all the pipeline tasks to read/write common resources
name: source
tasks:
- name: prepare-dockerfile
timeout: 30m
retries: 0
taskRef:
kind: ClusterTask
name: alauda-script
workspaces:
- name: source
workspace: source
params:
- name: tool-image
value: registry.alauda.cn:60080/fundamentals/katanomi-ci-builder:master
- name: script
value: |
./tests/test-engine-image generate.sh
- name: build-image-amd
timeout: 60m
retries: 0
runAfter:
- prepare-dockerfile
taskRef:
kind: Task
name: buildx
kind: ClusterTask
name: build-image-buildkit
workspaces:
- name: source
workspace: source
- name: cache
- name: config
when: [ ]
when: []
params:
- name: reuse-image
value: "false"
- name: dockerfile
value: tests/test-engine-image/Dockerfile
- name: container-images
value:
- build-harbor.alauda.cn/fundamentals/harbor-e2e-engine:4.2.1-api
Expand All @@ -29,25 +48,11 @@ spec:
- branch=$(build.git.branch.name)
- commit=$(build.git.lastCommit.id)
- commit_id=$(build.git.lastCommit.id)
- name: build-image-amd
timeout: 60m
retries: 0
taskRef:
kind: Task
name: buildx
workspaces:
- name: source
workspace: source
- name: cache
- name: config
when: []
params:
- name: command
value:
- ./tests/test-engine-image/build.sh api 4.2.1
- name: build-image-arm
timeout: 60m
retries: 0
runAfter:
- prepare-dockerfile
taskRef:
kind: ClusterTask
name: build-image-buildkit
Expand All @@ -58,9 +63,18 @@ spec:
- name: config
when: []
params:
- name: command
- name: reuse-image
value: "false"
- name: dockerfile
value: tests/test-engine-image/Dockerfile
- name: container-images
value:
- build-harbor.alauda.cn/fundamentals/harbor-e2e-engine:4.2.1-api
- name: labels
value:
- ./tests/test-engine-image/build.sh api 4.2.1
- branch=$(build.git.branch.name)
- commit=$(build.git.lastCommit.id)
- commit_id=$(build.git.lastCommit.id)
- name: merge-image
runAfter:
- build-image-amd
Expand All @@ -81,3 +95,14 @@ spec:
value:
- $(tasks.build-image-amd.results.ociContainerImageBuild-url)
- $(tasks.build-image-arm.results.ociContainerImageBuild-url)
runTemplate:
spec:
taskRunSpecs:
- pipelineTaskName: build-image-arm
taskPodTemplate:
nodeSelector:
kubernetes.io/arch: arm64
Tolerations:
- key: build-arm
operator: Exists
effect: NoSchedule
2 changes: 1 addition & 1 deletion tests/test-engine-image/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ fi
$CMD_BASE $SRC_FILE >> $DST_FILE

echo "Starting to build image ..."
TARGET_IMAGE=build-harbor.alauda.cn/fundamentals/harbor-e2e-engine:${VERSION}-${IMAGE_FOR}
TARGET_IMAGE=goharbor/harbor-e2e-engine:${VERSION}-${IMAGE_FOR}
docker build -t $TARGET_IMAGE .

27 changes: 27 additions & 0 deletions tests/test-engine-image/generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
set -x
set -e

IMAGE_FOR=$1
VERSION=$2

CMD_BASE="cat Dockerfile.common"
SRC_FILE=""
DST_FILE=Dockerfile

echo "Starting to prepare Dockerfile for $IMAGE_FOR ..."
if [ "$IMAGE_FOR" == "api" ]; then
SRC_FILE=Dockerfile.api_test
else
SRC_FILE=Dockerfile.ui_test
fi

if [ ! -r $SRC_FILE ]; then
echo "File $SRC_FILE does not exists at all!"
exit -1
fi

if [ -f $DST_FILE ]; then
rm $DST_FILE
fi
$CMD_BASE $SRC_FILE >> $DST_FILE

0 comments on commit 098dd9e

Please sign in to comment.