Package Trigger Main #140
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Package Trigger Main | |
on: | |
workflow_dispatch: | |
jobs: | |
package-trigger-kali: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: Package Trigger | |
if: github.ref == 'refs/heads/kali' | |
run: | | |
if [ -n "${{ secrets.PAUSE_PACKAGE_TRIGGER_BASEIMAGE_DEBIAN_KALI }}" ]; then | |
echo "**** Github secret PAUSE_PACKAGE_TRIGGER_BASEIMAGE_DEBIAN_KALI is set; skipping trigger. ****" | |
echo "Github secret \`PAUSE_PACKAGE_TRIGGER_BASEIMAGE_DEBIAN_KALI\` is set; skipping trigger." >> $GITHUB_STEP_SUMMARY | |
exit 0 | |
fi | |
if [ $(curl -s https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-baseimage-debian/job/kali/lastBuild/api/json | jq -r '.building') == "true" ]; then | |
echo "**** There already seems to be an active build on Jenkins; skipping package trigger ****" | |
echo "There already seems to be an active build on Jenkins; skipping package trigger" >> $GITHUB_STEP_SUMMARY | |
exit 0 | |
fi | |
echo "**** Package trigger running off of kali branch. To disable, set a Github secret named \"PAUSE_PACKAGE_TRIGGER_BASEIMAGE_DEBIAN_KALI\". ****" | |
echo "Package trigger running off of kali branch. To disable, set a Github secret named \`PAUSE_PACKAGE_TRIGGER_BASEIMAGE_DEBIAN_KALI\`" >> $GITHUB_STEP_SUMMARY | |
response=$(curl -iX POST \ | |
https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-baseimage-debian/job/kali/buildWithParameters?PACKAGE_CHECK=true \ | |
--user ${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_TOKEN }} | grep -i location | sed "s|^[L|l]ocation: \(.*\)|\1|") | |
echo "**** Jenkins job queue url: ${response%$'\r'} ****" | |
echo "**** Sleeping 10 seconds until job starts ****" | |
sleep 10 | |
buildurl=$(curl -s "${response%$'\r'}api/json" | jq -r '.executable.url') | |
buildurl="${buildurl%$'\r'}" | |
echo "**** Jenkins job build url: ${buildurl} ****" | |
echo "Jenkins job build url: ${buildurl}" >> $GITHUB_STEP_SUMMARY | |
echo "**** Attempting to change the Jenkins job description ****" | |
curl -iX POST \ | |
"${buildurl}submitDescription" \ | |
--user ${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_TOKEN }} \ | |
--data-urlencode "description=GHA package trigger https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ | |
--data-urlencode "Submit=Submit" |