我目前正在配置一个由许多平台构建组成的管道.在管道的开头,用户可以选择要构建或跳过的平台.
根据每个平台的"构建"阶段是通过还是失败,下游阶段的步骤可以检查该平台构建的状态并确定是否运行.如果一个或多个平台发生故障,这允许管道尝试并完成其他平台(如果用户确认这样做).
目前,我的管道实现了这一点,允许用户在管道开始时包含/排除平台,并授权管道在平台发生故障时继续构建(但将管道标记为故障).这允许存档构建文件/发布gtests等,这可以在下游阶段/步骤中完成.这是我的Jenkinsfile:
// Specify whether or not to build platform by default
def buildDefinitions = [ 'windows' : true , 'macos' : true , 'ubuntu' : true ]
// Keep track of builds that fail
def failedBuilds = [:]
stage('Build Customisation') {
try {
// Wait limited amount of time for user input
timeout(time: 30, unit: 'SECONDS') {
// Update the build definitions based on user input
buildDefinitions = input(
message: 'Toggle which builds to run (Abort …Run Code Online (Sandbox Code Playgroud) 我编写了一个 Google Apps 脚本,它将电子表格中保存的事件添加到谷歌日历中。每个事件都会存储日历事件的 ID,以便在电子表格中的事件发生修改时可以更新它。该事件仍然可以在日历中手动删除,因此我希望脚本能够检测到这一点并重新创建该事件。不幸的是,我不能简单地检查null何时调用getEventById(...)对象calendar,因为即使删除后,该函数似乎也会返回有效的calendar对象。
APICalendarEvent文档似乎没有指出一种方法来检查事件是否已通过 UI/手动删除。有没有办法通过 Google Apps API 访问此属性?
即使永久删除垃圾事件也不能解决问题,尽管它可以防止对返回的event对象进行修改。
我可以用什么来检查事件(仍然存在)是否已被“删除”?我认为唯一可能有用的是对象get/setTag()的方法CalendarEvent。
或者,这个问题看起来很相似,但感觉应该有一种比搜索废弃事件列表更好的方法,而且我不确定这是否可以解决让 ID 字符串返回“永久”的有效事件的问题。 ”删除了。
var calendarId = "abc123@group.calendar.google.com"
var calendar = CalendarApp.getCalendarById(calendarId);
var event = calendar.createEvent(...);
// Event is then deleted manually in calendar but
// ID has been saved in spreadsheet (or elsewhere)
if (calendar.getEventById("the-deleted-event-id") == null) {
// Create the event (This is never reached)
} …Run Code Online (Sandbox Code Playgroud)