[ci] Fix and improve k8s master image build process (#18157)
Why I did it When we change k8s script file to trigger k8s master image build, there's error reported. /agent/_work/_temp/433f6aca-4fd0-4a79-898e-49d7d0fc7465.sh: line 19: unexpected EOF while looking for matching `'' The main reason is something wrong with passing k8s_options variable(in file template-skipvstest.yml) to build pipeline. Need to fix and improve the passing variable process. Work item tracking Microsoft ADO (number only): 25063800 How I did it Separate the job of checking if k8s image build is needed from skipvstest checking job Build a VHDX k8s master image for convenient How to verify it No error found when k8s master image build is triggered We have a VHDX k8s master image in the build result.
This commit is contained in:
parent
9505f820c1
commit
cd897b40cc
@ -135,9 +135,13 @@ jobs:
|
|||||||
make $BUILD_OPTIONS ENABLE_ASAN=y target/docker-sonic-vs.gz
|
make $BUILD_OPTIONS ENABLE_ASAN=y target/docker-sonic-vs.gz
|
||||||
mv target/docker-sonic-vs.gz target/docker-sonic-vs-asan.gz
|
mv target/docker-sonic-vs.gz target/docker-sonic-vs-asan.gz
|
||||||
fi
|
fi
|
||||||
if [ "$(K8S_OPTIONS)" == 'INCLUDE_KUBERNETES_MASTER=y' ]; then
|
if [ "$(K8S_MASTER_CHANGED)" == 'YES' ]; then
|
||||||
make $BUILD_OPTIONS $(K8S_OPTIONS) target/sonic-vs.img.gz
|
make $BUILD_OPTIONS INCLUDE_KUBERNETES_MASTER=y target/sonic-vs.img.gz
|
||||||
mv target/sonic-vs.img.gz target/sonic-vs-k8s.img.gz
|
gzip -d target/sonic-vs.img.gz
|
||||||
|
SONIC_RUN_CMDS="qemu-img convert target/sonic-vs.img -O vhdx -o subformat=dynamic target/sonic-vs.vhdx" make $BUILD_OPTIONS sonic-slave-run
|
||||||
|
gzip target/sonic-vs.vhdx
|
||||||
|
mv target/sonic-vs.vhdx.gz target/sonic-vs-k8s.vhdx.gz
|
||||||
|
rm target/sonic-vs.img
|
||||||
fi
|
fi
|
||||||
make $BUILD_OPTIONS target/docker-sonic-vs.gz target/sonic-vs.img.gz target/docker-ptf.gz
|
make $BUILD_OPTIONS target/docker-sonic-vs.gz target/sonic-vs.img.gz target/docker-ptf.gz
|
||||||
make $BUILD_OPTIONS target/docker-ptf-sai.gz
|
make $BUILD_OPTIONS target/docker-ptf-sai.gz
|
||||||
|
@ -4,11 +4,16 @@ steps:
|
|||||||
set -ex
|
set -ex
|
||||||
tar_branch=origin/$(System.PullRequest.TargetBranchName)
|
tar_branch=origin/$(System.PullRequest.TargetBranchName)
|
||||||
# Check if k8s master entrance script is changed
|
# Check if k8s master entrance script is changed
|
||||||
if ! git diff $tar_branch..HEAD --name-only | grep -F files/image_config/kubernetes/kubernetes_master_entrance.sh; then
|
K8S_MASTER_CHANGED=NO
|
||||||
echo "##vso[task.setvariable variable=K8S_OPTIONS;]INCLUDE_KUBERNETES_MASTER=n"
|
if git diff $tar_branch..HEAD --name-only | grep -F files/image_config/kubernetes/kubernetes_master_entrance.sh; then
|
||||||
else
|
K8S_MASTER_CHANGED=YES
|
||||||
echo "##vso[task.setvariable variable=K8S_OPTIONS;]INCLUDE_KUBERNETES_MASTER=y"
|
|
||||||
fi
|
fi
|
||||||
|
set +x
|
||||||
|
echo "##vso[task.setvariable variable=K8S_MASTER_CHANGED;]$K8S_MASTER_CHANGED"
|
||||||
|
displayName: "Check if k8s master image build is needed."
|
||||||
|
- script: |
|
||||||
|
set -ex
|
||||||
|
tar_branch=origin/$(System.PullRequest.TargetBranchName)
|
||||||
git diff $tar_branch..HEAD --name-only | grep -v -f .azure-pipelines/vstest-exclude && exit 0
|
git diff $tar_branch..HEAD --name-only | grep -v -f .azure-pipelines/vstest-exclude && exit 0
|
||||||
git diff $tar_branch..HEAD --name-only | grep -f .azure-pipelines/vstest-include && exit 0
|
git diff $tar_branch..HEAD --name-only | grep -f .azure-pipelines/vstest-include && exit 0
|
||||||
set +x
|
set +x
|
||||||
|
Loading…
Reference in New Issue
Block a user