nix(feat): Create all temporary directories with script name template
Temporary directories are now created in $TMPDIR/postgrest/script-name-XXX. This allows recognizing the origin of a single temporary directory and uploading the whole $TMPDIR/postgrest folder as an artifact in CI.
This commit is contained in:
committed by
Wolfgang Walther
parent
14ddecc81a
commit
c691b37f76
@@ -67,6 +67,8 @@ jobs:
|
|||||||
name: run spec tests
|
name: run spec tests
|
||||||
command: |
|
command: |
|
||||||
test/create_test_db "postgres://circleci@localhost" postgrest_test stack test
|
test/create_test_db "postgres://circleci@localhost" postgrest_test stack test
|
||||||
|
- store_artifacts:
|
||||||
|
path: /tmp/postgrest
|
||||||
|
|
||||||
# Publish a new release. This only runs when a release is tagged (see
|
# Publish a new release. This only runs when a release is tagged (see
|
||||||
# workflow below).
|
# workflow below).
|
||||||
@@ -111,6 +113,8 @@ jobs:
|
|||||||
then
|
then
|
||||||
postgrest-release-dockerhub-description
|
postgrest-release-dockerhub-description
|
||||||
fi
|
fi
|
||||||
|
- store_artifacts:
|
||||||
|
path: /tmp/postgrest
|
||||||
|
|
||||||
# Build everything in default.nix and push to the Cachix binary cache if running on main
|
# Build everything in default.nix and push to the Cachix binary cache if running on main
|
||||||
nix-build:
|
nix-build:
|
||||||
@@ -154,6 +158,8 @@ jobs:
|
|||||||
echo "Building all derivations (caching skipped for outside pull requests)..."
|
echo "Building all derivations (caching skipped for outside pull requests)..."
|
||||||
nix-build
|
nix-build
|
||||||
fi
|
fi
|
||||||
|
- store_artifacts:
|
||||||
|
path: /tmp/postgrest
|
||||||
|
|
||||||
# Run tests
|
# Run tests
|
||||||
nix-test:
|
nix-test:
|
||||||
@@ -218,7 +224,8 @@ jobs:
|
|||||||
name: Run memory tests
|
name: Run memory tests
|
||||||
command: postgrest-test-memory
|
command: postgrest-test-memory
|
||||||
when: always
|
when: always
|
||||||
|
- store_artifacts:
|
||||||
|
path: /tmp/postgrest
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
# to be used in a path for example.
|
# to be used in a path for example.
|
||||||
{ argbash
|
{ argbash
|
||||||
, bash_5
|
, bash_5
|
||||||
|
, coreutils
|
||||||
, git
|
, git
|
||||||
, lib
|
, lib
|
||||||
, runCommand
|
, runCommand
|
||||||
@@ -83,7 +84,7 @@ let
|
|||||||
|
|
||||||
+ lib.optionalString redirectTixFiles ''
|
+ lib.optionalString redirectTixFiles ''
|
||||||
# storing tix files in a temporary throw away directory avoids mix/tix conflicts after changes
|
# storing tix files in a temporary throw away directory avoids mix/tix conflicts after changes
|
||||||
hpctixdir=$(mktemp -d)
|
hpctixdir=$(${coreutils}/bin/mktemp -d)
|
||||||
export HPCTIXFILE="$hpctixdir"/postgrest.tix
|
export HPCTIXFILE="$hpctixdir"/postgrest.tix
|
||||||
trap 'rm -rf $hpctixdir' EXIT
|
trap 'rm -rf $hpctixdir' EXIT
|
||||||
''
|
''
|
||||||
@@ -99,7 +100,8 @@ let
|
|||||||
''
|
''
|
||||||
|
|
||||||
+ lib.optionalString withTmpDir ''
|
+ lib.optionalString withTmpDir ''
|
||||||
tmpdir="$(mktemp -d)"
|
mkdir -p "''${TMPDIR:-/tmp}/postgrest"
|
||||||
|
tmpdir="$(${coreutils}/bin/mktemp -d --tmpdir postgrest/${name}-XXX)"
|
||||||
|
|
||||||
# we keep the tmpdir when an error occurs for debugging
|
# we keep the tmpdir when an error occurs for debugging
|
||||||
trap 'echo Temporary directory kept at: $tmpdir' ERR
|
trap 'echo Temporary directory kept at: $tmpdir' ERR
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ let
|
|||||||
}
|
}
|
||||||
|
|
||||||
mkdir -p "$tmpdir"/{db,socket}
|
mkdir -p "$tmpdir"/{db,socket}
|
||||||
|
# remove data dir, even if we keep tmpdir - no need to upload it to artifacts
|
||||||
|
trap 'rm -rf $tmpdir/db' EXIT
|
||||||
|
|
||||||
export PGDATA="$tmpdir/db"
|
export PGDATA="$tmpdir/db"
|
||||||
export PGHOST="$tmpdir/socket"
|
export PGHOST="$tmpdir/socket"
|
||||||
|
|||||||
Reference in New Issue
Block a user