Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Skip builds based on tag within commit message #66

helmut.n ·

In one of our build configurations, builds are started every 10min if something has been committed. After the build, extensive tests are automatically performed. However, there are some changes for which we want to skip a separate build (and thus also tests), e.g. because only comments in the source code were changed.
In these cases the commit message contains the tag #NoBuild.
I have tried to evaluate the commit message in the Pre-Queue Script:

groovy: 
 
repo = repositories.get('SourceRepos'); 
logger.info('RepoName: ' + repo.getName()); 
 
for (changeSet in repo.getChanges() ) { 
   logger.info("change message (Rev " + changeSet.getId() + "): " + changeSet.getId() ); 
}

However, I then receive the following error message:

WARN  com.pmease.quickbuild.repositorysupport.Repository - Repository 'SourceRepos' in build 'XXX' does not have revision set.
WARN  com.pmease.quickbuild.repositorysupport.Repository - Can not calculate change sets as revision of repository 'SourceRepos' is not set for base build 'XXX'.

What am I doing wrong?

  • solved #2
  • replies 2
  • views 2089
  • stars 0
robinshen ADMIN ·

Doing this at pre-queue script will not work, as repository changes have not calculated yet. Instead, set build condition of the configuration to evaluate below script:

groovy: 
 
repo = repositories.get('SourceRepos'); 
logger.info('RepoName: ' + repo.getName()); 
 
for (changeSet in repo.getChanges() ) { 
   if (!changeSet.comment.contains("#NoBuild"))
     return true;
}

return false;
helmut.n ·

Thanks. :slight_smile:
This works.