[OS-BUILD PATCHv4 6/7] CI: ark-update-configs: sync push command and output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Don Zickus <dzickus@xxxxxxxxxx>

CI: ark-update-configs: sync push command and output

A rather large change that just moves everything into variables.  The
end result is the same except the push command is also echo'd before
being eval'd.  This allows the script to keep the command and output in
sync.

The script relies on the trap feature to cleanup the tempfile if
anything goes wrong.

No functional changes.

Signed-off-by: Don Zickus <dzickus@xxxxxxxxxx>

diff --git a/redhat/scripts/ci/ark-update-configs.sh b/redhat/scripts/ci/ark-update-configs.sh
index blahblah..blahblah 100755
--- a/redhat/scripts/ci/ark-update-configs.sh
+++ b/redhat/scripts/ci/ark-update-configs.sh
@@ -73,42 +73,40 @@ new_head="$(git rev-parse HEAD)"
 
 if test "$CONFIGS_ADDED"; then
 	./redhat/scripts/genspec/gen_config_patches.sh
+        PUSH_VERB="Pushing"
 else
 	printf "No new configuration values exposed from merging %s into $BRANCH\n" "$UPSTREAM_REF"
+        PUSH_VERB="To push"
 fi
 
-if test -n "$DIST_PUSH"; then
-        tmpfile=".push-warnings"
-	touch $tmpfile
-
-	echo "Pushing branch $(git branch --show-current) to $(git remote get-url gitlab)"
-	git push gitlab HEAD
-
-	echo "Pushing config update branches"
-	for branch in $(git branch | grep configs/"$(date +%F)"); do
-		git push \
- 			-o merge_request.create \
-			-o merge_request.target="$BRANCH" \
-			-o merge_request.remove_source_branch \
-			gitlab "$branch" 2>&1 | tee -a $tmpfile
-	done
-
-	# GitLab server side warnings do not fail git-push but leave verbose
-	# WARNING messages.  Grep for those and consider it a script
-	# failure.  Make sure all branches are pushed first as follow up
-	# git-pushes may succeed.
-	grep -q "remote:[ ]* WARNINGS" $tmpfile && RC=1 || RC=0
-	rm $tmpfile
-	test $RC && exit $RC
-else
-	printf "
-To push all the release artifacts, run:
+echo
+PUSH_STR="branch ${BRANCH} to ${GITLAB_URL}"
+PUSH_CMD="git push gitlab ${BRANCH}"
+PUSH_CONFIG_STR="config update branches"
+PUSH_CONFIG_CMD="for branch in \$(git branch | grep configs/\"\$(date +%F)\"); do
+	git push \\
+		-o merge_request.create \\
+		-o merge_request.target=\"$BRANCH\" \\
+		-o merge_request.remove_source_branch \\
+		gitlab \"\$branch\" 2>&1 | tee -a $TMPFILE
+done
+"
 
-git push gitlab HEAD
-for branch in \$(git branch | grep configs/\"\$(date +%%F)\"); do
-\tgit push -o merge_request.create -o merge_request.target=$BRANCH\
- -o merge_request.remove_source_branch upstream gitlab \"\$branch\"
-done\n"
+#Push branch
+echo "# $PUSH_VERB $PUSH_STR"
+echo "$PUSH_CMD"
+test "$TO_PUSH" && eval "$PUSH_CMD"
 
+#Push config branches if created
+if test "$CONFIGS_ADDED"; then
+	echo
+	echo "# $PUSH_VERB $PUSH_CONFIG_STR"
+	echo "$PUSH_CONFIG_CMD"
+	test "$TO_PUSH" && eval "$PUSH_CONFIG_CMD"
 fi
 
+# GitLab server side warnings do not fail git-push but leave verbose
+# WARNING messages.  Grep for those and consider it a script
+# failure.  Make sure all branches are pushed first as follow up
+# git-pushes may succeed.
+grep -q "remote:[ ]* WARNINGS" $TMPFILE && die "Server side warnings"

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2519
_______________________________________________
kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux