1
0
mirror of https://github.com/rancher/os.git synced 2025-07-01 09:11:48 +00:00

Optimize the release script

This commit is contained in:
niusmallnan 2017-12-21 17:25:31 +08:00
parent b9fea2e8d3
commit 0e586b7996

View File

@ -15,24 +15,24 @@ echo PACKAGE
./scripts/package ./scripts/package
if [[ "$INTEGRATION_TESTS" != "" ]]; then if [[ "$INTEGRATION_TESTS" != "" ]]; then
if [[ "$ARCH" == "" || "$ARCH" == "amd64" ]]; then if [[ "$ARCH" == "" || "$ARCH" == "amd64" ]]; then
export INTEGRATION_TESTS=1 export INTEGRATION_TESTS=1
else else
export INTEGRATION_TESTS=0 export INTEGRATION_TESTS=0
fi fi
fi fi
if [[ "$INTEGRATION_TESTS" != "1" ]]; then if [[ "$INTEGRATION_TESTS" != "1" ]]; then
echo INTEGRATION-TEST echo INTEGRATION-TEST
./scripts/integration-test ./scripts/integration-test
else else
echo "Skipping integration tests" echo "Skipping integration tests"
fi fi
if [[ "$ARCH" == "" || "$ARCH" == "amd64" ]]; then #if [[ "$ARCH" == "" || "$ARCH" == "amd64" ]]; then
# make generated changelog ## make generated changelog
lastrelease=$(hub release | grep -v rc | head -n1 | tr -d ' \r\n') #lastrelease=$(hub release | grep -v rc | head -n1 | tr -d ' \r\n')
git log --format="%s: %b" ${lastrelease}..${VERSION} | grep "Merge pull" | sed 's/.*\(#.*\) from .*:\(.*\)/* \1: \2/g' > dist/artifacts/changelog.txt #git log --format="%s: %b" ${lastrelease}..${VERSION} | grep "Merge pull" | sed 's/.*\(#.*\) from .*:\(.*\)/* \1: \2/g' > dist/artifacts/changelog.txt
fi #fi
CHECKSUM="dist/checksums.txt" CHECKSUM="dist/checksums.txt"
rm -f $CHECKSUM rm -f $CHECKSUM
@ -42,34 +42,47 @@ cat scripts/hosting/rancheros.ipxe | sed "s/latest/${VERSION}/g" > dist/artifact
echo "github-release release --user rancher --repo os --tag ${VERSION} --pre-release --draft" > dist/publish.sh echo "github-release release --user rancher --repo os --tag ${VERSION} --pre-release --draft" > dist/publish.sh
chmod 755 dist/publish.sh chmod 755 dist/publish.sh
touch dist/publish_gss_${VERSION}.sh dist/publish_gss_latest.sh
chmod 755 dist/publish_gss_${VERSION}.sh dist/publish_gss_latest.sh
for file in $(ls dist/artifacts/); do for file in $(ls dist/artifacts/); do
if [[ "$file" == *"installer.tar" ]]; then case $file in
continue *"installer.tar" | "Dockerfile"*)
fi ;;
if [[ "$file" == "Dockerfile"* ]]; then "initrd-"*)
continue echo "github-release upload --user rancher --repo os --tag ${VERSION} --file ./dist/artifacts/${file} --name initrd" >> dist/publish.sh
fi echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/latest/initrd" >> ./dist/publish_gss_latest.sh
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/${VERSION}/initrd" >> ./dist/publish_gss_${VERSION}.sh
;;
"vmlinuz-"*)
echo "github-release upload --user rancher --repo os --tag ${VERSION} --file ./dist/artifacts/${file} --name vmlinuz" >> dist/publish.sh
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/latest/vmlinuz" >> ./dist/publish_gss_latest.sh
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/${VERSION}/vmlinuz" >> ./dist/publish_gss_${VERSION}.sh
;;
*)
echo "github-release upload --user rancher --repo os --tag ${VERSION} --file ./dist/artifacts/${file} --name ${file}" >> dist/publish.sh
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/latest/${file}" >> ./dist/publish_gss_latest.sh
echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/${VERSION}/${file}" >> ./dist/publish_gss_${VERSION}.sh
;;
esac
echo "github-release upload --user rancher --repo os --tag ${VERSION} --file ./dist/artifacts/${file} --name ${file}" >> dist/publish.sh #checksums
if [[ "$file" == "initrd-"* ]]; then pushd .
echo "github-release upload --user rancher --repo os --tag ${VERSION} --file ./dist/artifacts/${file} --name initrd" >> dist/publish.sh cd dist/artifacts
fi for algo in sha256 md5; do
if [[ "$file" == "vmlinuz-"* ]]; then echo "$algo: $(${algo}sum $file)" >> ../../$CHECKSUM
echo "github-release upload --user rancher --repo os --tag ${VERSION} --file ./dist/artifacts/${file} --name vmlinuz" >> dist/publish.sh done
fi popd
#checksums
pushd .
cd dist/artifacts
for algo in sha256 md5; do
echo "$algo: $(${algo}sum $file)" >> ../../$CHECKSUM
done
popd
done done
echo "github-release upload --user rancher --repo os --tag ${VERSION} --file dist/release.log --name release.log" >> dist/publish.sh echo "github-release upload --user rancher --repo os --tag ${VERSION} --file dist/release.log --name release.log" >> dist/publish.sh
for extra_file in rancheros-openstack.img rancheros-digitalocean.img; do
echo "github-release upload --user rancher --repo os --tag ${VERSION} --file dist/${extra_file} --name ${extra_file}" >> dist/publish.sh
echo "gsutil cp dist/artifacts/${extra_file} gs://releases.rancher.com/os/latest/${extra_file}" >> ./dist/publish_gss_latest.sh
echo "gsutil cp dist/artifacts/${extra_file} gs://releases.rancher.com/os/${VERSION}/${extra_file}" >> ./dist/publish_gss_${VERSION}.sh
done
# openstack image is made later atm # openstack image is made later atm
#echo "github-release upload --user rancher --repo os --tag ${VERSION} --file dist/rancheros-openstack.img --name rancheros-openstack.img" >> dist/publish.sh
#pushd . #pushd .
#cd dist #cd dist
#for algo in sha256 md5; do #for algo in sha256 md5; do
@ -78,7 +91,7 @@ echo "github-release upload --user rancher --repo os --tag ${VERSION} --file di
#popd #popd
echo "github-release upload --user rancher --repo os --tag ${VERSION} --file ${CHECKSUM} --name checksums.txt" >> dist/publish.sh echo "github-release upload --user rancher --repo os --tag ${VERSION} --file ${CHECKSUM} --name checksums.txt" >> dist/publish.sh
echo "github-release upload --user rancher --repo os --tag ${VERSION} --file dist/artifacts/changelog.txt --name changelog.txt" >> dist/publish.sh #echo "github-release upload --user rancher --repo os --tag ${VERSION} --file dist/artifacts/changelog.txt --name changelog.txt" >> dist/publish.sh
echo >> dist/publish.sh echo >> dist/publish.sh
@ -87,11 +100,6 @@ cat dist/images | sed 's/^/docker push /' >> dist/publish.sh
echo "--- Run dist/publish.sh" echo "--- Run dist/publish.sh"
cat dist/publish.sh cat dist/publish.sh
# create scripts about uploading to google storage echo "--- Run dist/publish_gss.sh"
cp dist/artifacts/initrd-${VERSION} dist/artifacts/initrd cat dist/publish_gss_latest.sh
cp dist/artifacts/vmlinuz-${KERNEL_VERSION} dist/artifacts/vmlinuz cat dist/publish_gss_${VERSION}.sh
echo "gsutil cp dist/artifacts/* gs://releases.rancher.com/os/latest" > ./dist/publish_gs.sh
echo "gsutil cp dist/artifacts/* gs://releases.rancher.com/os/${VERSION}" >> ./dist/publish_gs.sh
chmod 755 ./dist/publish_gs.sh
echo "--- Run dist/publish_gs.sh"
cat dist/publish_gs.sh