if(DASHBOARD_FAILURE OR DASHBOARD_UNSTABLE)
  notice("CTest Status: NOT CREATING PACKAGE ARCHIVE BECAUSE BAZEL BUILD WAS NOT SUCCESSFUL")
else()
  notice("CTest Status: CREATING PACKAGE ARCHIVE")
  string(TIMESTAMP DATE "%Y%m%d")
  string(TIMESTAMP TIME "%H%M%S")
  execute_process(COMMAND "${CTEST_GIT_COMMAND}" rev-parse HEAD
    WORKING_DIRECTORY "${CTEST_SOURCE_DIRECTORY}"
    RESULT_VARIABLE GIT_REV_PARSE_RESULT_VARIABLE
    OUTPUT_VARIABLE GIT_REV_PARSE_OUTPUT_VARIABLE
    OUTPUT_STRIP_TRAILING_WHITESPACE)
  if(NOT GIT_REV_PARSE_RESULT_VARIABLE EQUAL 0)
    append_step_status("BAZEL PACKAGE ARCHIVE CREATION" UNSTABLE)
  endif()
  if(NOT DASHBOARD_UNSTABLE)
    file(WRITE /opt/drake/share/doc/drake/VERSION.TXT "${DATE}${TIME} ${GIT_REV_PARSE_OUTPUT_VARIABLE}")
    if(APPLE)
      set(DASHBOARD_PACKAGE_ARCHIVE_DISTRIBUTION mac)
    else()
      set(DASHBOARD_PACKAGE_ARCHIVE_DISTRIBUTION "${DASHBOARD_UNIX_DISTRIBUTION_CODE_NAME}")
    endif()
    if(DASHBOARD_TRACK STREQUAL "Nightly")
      set(DASHBOARD_PACKAGE_NAME "drake-${DATE}")
    else()
     set(DASHBOARD_PACKAGE_NAME "drake-${DATE}${TIME}-${GIT_REV_PARSE_OUTPUT_VARIABLE}")
    endif()
    set(DASHBOARD_PACKAGE_ARCHIVE_NAME "${DASHBOARD_PACKAGE_NAME}-${DASHBOARD_PACKAGE_ARCHIVE_DISTRIBUTION}.tar.gz")
    execute_process(COMMAND "${CMAKE_COMMAND}" -E tar czf "${DASHBOARD_WORKSPACE}/${DASHBOARD_PACKAGE_ARCHIVE_NAME}" drake
      WORKING_DIRECTORY /opt
      RESULT_VARIABLE TAR_RESULT_VARIABLE)
    if(NOT TAR_RESULT_VARIABLE EQUAL 0)
      append_step_status("BAZEL PACKAGE ARCHIVE CREATION" UNSTABLE)
    endif()
  endif()
endif()
