embeddedartistry / athena-bootloader

An AVR Arduino bootloader that supports uploads over Ethernet (via TFTP) and Serial.
GNU Lesser General Public License v2.1
12 stars 5 forks source link

Figure out new nightly CI strategy #90

Closed phillipjohnston closed 2 years ago

phillipjohnston commented 2 years ago

Because the nightly build starts with a new tag, the build step will always generate new images (version number has changed), causing nightly builds to continually run even when there are no other changes.

For now, this has been removed.

-    stage('Commit Updated Images')
-    {
-      steps
-      {
-
-        sh 'git checkout master'
-        sh 'git pull'
-        sh 'git commit -am "Updating firmware images with latest version number."'
-        sh 'git push'
-      }
-    }
phillipjohnston commented 2 years ago

Maybe we can put the smarts into the Makefile somehow.

phillipjohnston commented 2 years ago

Or a nightly_build.sh script.

hagaigold commented 2 years ago

Or a nightly_build.sh script.

I am not familiar with how to propagate the result of the script to the Jenkins system (to stop or not the build stage), but below are two options to check against the git log.

Based on the last tag name, similar to what we have in the Makefile to extract the last version: (this will work assuming there is no - in the tag names)

#!/bin/bash

last_tag=$(git describe --long --dirty --tags)
tokens=(${last_tag//-/ })
number_of_commits_from_last_tag=${tokens[1]} 

#echo ${last_tag}
#echo ${number_of_commits_from_last_tag}

if [ ${number_of_commits_from_last_tag} -gt 0 ]
then
    echo 'do work'
else
    echo 'nothing to do...'
fi

Based on the last committer, if it is not Embedded Artistry Buildbot: (this will work assuming Buildbot does not commit "something" that needs to trigger a new nightly build)

#!/bin/bash

if ! (git log -1 --pretty=format:'%an' | grep -iq buildbot)
then
    echo 'do work'
else
    echo 'nothing to do...'
fi
hagaigold commented 2 years ago

I experimented a bit with Jenkins: there are setting that you might use, which are not available for Multibranch Pipeline, like Polling ignores commits with certain messages or Polling ignores commits from certain users.

But I think that we don't really need to keep (push) the build results. They are uploaded to the release area anyway. If we go that direction:

this way, the pipeline will just Tag & create a new release with the new changes. If someone decides to clone the code, I assume he will want to build it anyway.

phillipjohnston commented 2 years ago

I agree, and I think with the work on being able to use the board manager will also obviate the need to clone (whereas before that wasn't an option)

phillipjohnston commented 2 years ago

I still needed to resolve this to address auto-generating the JSON file for each set of generated files. But this is now fixed - builds will abort if there have been no commits since the previous tag was created. Tags are created by the nightly build configuration after the JSON is committed.