Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds workflow retry if it fails #407

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 47 additions & 10 deletions dev-tools/build-packages/build-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,21 @@ build_tar() {
container_name="dashboard-base-builder"
cp ./base-builder.sh ${dockerfile_path}
cp ./plugins ${dockerfile_path}
docker build -t ${container_name} ${dockerfile_path} || return 1
docker run -t --rm -v ${tmp_dir}/:/tmp:Z -v ${output_dir}/:/output:Z\
${container_name} ${version} ${revision} ${architecture} ${verbose}|| return 1
for i in {1..5}; do
if docker build -t ${container_name} ${dockerfile_path} && \
docker run -t --rm \
-v ${tmp_dir}/:/tmp:Z \
-v ${output_dir}/:/output:Z \
${container_name} ${version} ${revision} ${architecture} ${verbose}; then
break
else
if [ $i -eq 5 ]; then
echo "Failed to build the base package after 5 attempts"
exit 1
fi
sleep 15
fi
done
yenienserrano marked this conversation as resolved.
Show resolved Hide resolved
cd ..
}

Expand All @@ -106,10 +118,22 @@ build_rpm() {
cp -r ${package_config_dir} ${tmp_dir}
cp ./rpm-builder.sh ${dockerfile_path}
cp ./wazuh-dashboard.spec ${dockerfile_path}
docker build -t ${container_name} ${dockerfile_path} || return 1
docker run -t --rm -v ${tmp_dir}/:/tmp:Z -v ${output_dir}/:/output:Z\
${container_name} ${version} ${revision} ${architecture}\
${commit_sha} ${production} ${verbose}|| return 1
for i in {1..5}; do
if docker build -t ${container_name} ${dockerfile_path} && \
docker run -t --rm \
-v ${tmp_dir}/:/tmp:Z \
-v ${output_dir}/:/output:Z \
${container_name} ${version} ${revision} ${architecture} \
${commit_sha} ${production} ${verbose}; then
break
else
if [ $i -eq 5 ]; then
echo "Failed to build the rpm package after 5 attempts"
exit 1
fi
sleep 15
fi
done
yenienserrano marked this conversation as resolved.
Show resolved Hide resolved
cd ../
}

Expand All @@ -123,9 +147,22 @@ build_deb() {
cp ./deb-builder.sh ${dockerfile_path}
cp -r ./debian ${dockerfile_path}
docker build -t ${container_name} ${dockerfile_path} || return 1
docker run -t --rm -v ${tmp_dir}/:/tmp:Z -v ${output_dir}/:/output:Z \
${container_name} ${version} ${revision} ${architecture}\
${commit_sha} ${production} ${verbose}|| return 1
for i in {1..5}; do
if docker build -t ${container_name} ${dockerfile_path} && \
docker run -t --rm \
-v ${tmp_dir}/:/tmp:Z \
-v ${output_dir}/:/output:Z \
${container_name} ${version} ${revision} ${architecture} \
${commit_sha} ${production} ${verbose}; then
break
else
if [ $i -eq 5 ]; then
echo "Failed to build the deb package after 5 attempts"
exit 1
fi
sleep 15
fi
done
yenienserrano marked this conversation as resolved.
Show resolved Hide resolved
cd ..
}

Expand Down
32 changes: 26 additions & 6 deletions dev-tools/test-packages/test-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,33 @@ check_metadata_rpm() {
test() {

if [[ $PACKAGE == *".deb" ]]; then
docker build --build-arg PACKAGE=$PACKAGE -t $CONTAINER_NAME ./deb/
docker run -it --rm -d --name $CONTAINER_NAME $CONTAINER_NAME
check_metadata_deb
for i in {1..5}; do
if docker build --build-arg PACKAGE=$PACKAGE -t $CONTAINER_NAME ./deb/ && \
docker run -it --rm -d --name $CONTAINER_NAME $CONTAINER_NAME && \
check_metadata_deb; then
break
else
if [ $i -eq 5 ]; then
echo "Failed to test the deb package after 5 attempts"
exit 1
fi
sleep 15
fi
done
yenienserrano marked this conversation as resolved.
Show resolved Hide resolved
elif [[ $PACKAGE == *".rpm" ]]; then
docker build --build-arg PACKAGE=$PACKAGE -t $CONTAINER_NAME ./rpm/
docker run -it --rm -d --name $CONTAINER_NAME $CONTAINER_NAME
check_metadata_rpm
for i in {1..5}; do
if docker build --build-arg PACKAGE=$PACKAGE -t $CONTAINER_NAME ./rpm/ && \
docker run -it --rm -d --name $CONTAINER_NAME $CONTAINER_NAME && \
check_metadata_rpm; then
break
else
if [ $i -eq 5 ]; then
echo "Failed to test the rpm package after 5 attempts"
exit 1
fi
sleep 15
fi
done
yenienserrano marked this conversation as resolved.
Show resolved Hide resolved
else
echo "ERROR: $PACKAGE is not a valid package (valid packages are .deb and .rpm ))"
exit 1
Expand Down
Loading