HomePhabricator

[CI] Ensure the artifact directory is always created

Description

[CI] Ensure the artifact directory is always created

Summary:
The is an edge case that can cause the artifcacts directory to no be
created before the artifacts are copied. The consequence is that it is
possible that a file named after the artifacts directory gets created,
and prevent subsequent builds of the same type from running.

The conditions are:

  • The build should be done on a user machine (not on CI)
  • The build should run no install target
  • There should be a single file artifact copied to the root of the artifacts directory, and this file should be the first of the artifact list. This is always the case as the log files are hardcoded first.
  • The build should run the build_cmake.sh script

What happens is that the artifacts directory for user builds is located
under the build directory, and this directory gets removed by the call
to git clean -xffd from the build_cmake.sh script. If no install
target is run, the artifact directory remains inexistant until the
artifact copy routine is called. The destination of the log files being
the root of the artifacts directory, it translates to a copy command
similar to cp <build_dir>/build.clean.log <build_dir>/artifacts which
effectively copies the log file to a new file called artifacts.

Test Plan:
This edge case can be easily reproduced by running the build on a user
machine, and kill it with CTRL+C after the cmake command launched. That
way nothing could possibly be installed yet and the artifacts directory
is removed:

./contrib/teamcity/build-configurations.py build-asan
# wait a second or so and hit CTRL+C
ls -al abc-ci-builds/build-asan/artifacts

Without this patch artifacts will be a file, with this patch it will
be a directory. With the patch, you can also rerun the build and see no
failure:

./contrib/teamcity/build-configurations.py build-asan

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D7356

Details

Provenance
FabienAuthored on Sep 4 2020, 14:47
abc-botPushed on Sep 4 2020, 14:52
Reviewer
Restricted Project
Differential Revision
D7356: [CI] Ensure the artifact directory is always created
Parents
rABC002285c699fd: [CMAKE] Add a target to print the current version number
Branches
Unknown
Tags
Unknown