Skip to content
This repository has been archived by the owner on Jan 21, 2025. It is now read-only.

Mak/fix gitlab script #153

Merged
merged 3 commits into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 20 additions & 21 deletions src/gitlab/__snapshots__/createCiConfig.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,26 @@ exports[`createCiConfig PIPELINE_SCRIPTS_REF and other VARs are applied, while P
},
"image": "image",
"script": [
"
echo "This job is related to task 123. job Task info message."

# The scripts repository might be left over from a previous run in the
# same Gitlab shell executor

rm -rf "$PIPELINE_SCRIPTS_DIR"
if [ "\${PIPELINE_SCRIPTS_REPOSITORY:-}" ]; then
if [ "\${PIPELINE_SCRIPTS_REF:-}" ]; then
git clone --progress --verbose --depth 1 --branch "$PIPELINE_SCRIPTS_REF" "$PIPELINE_SCRIPTS_REPOSITORY" "$PIPELINE_SCRIPTS_DIR"
else
git clone --progress --verbose --depth 1 "$PIPELINE_SCRIPTS_DIR"
fi
fi
export ARTIFACTS_DIR="$PWD/.git/.artifacts"
# The scripts repository might be left over from a previous run in the
# same Gitlab shell executor

rm -rf "$PIPELINE_SCRIPTS_DIR"
mkdir -p "$ARTIFACTS_DIR"
",
"",
" echo "This job is related to task 123. job Task info message."",
"",
" # The scripts repository might be left over from a previous run in the",
" # same Gitlab shell executor",
" rm -rf "$PIPELINE_SCRIPTS_DIR"",
"",
" if [ "\${PIPELINE_SCRIPTS_REPOSITORY:-}" ]; then",
" if [ "\${PIPELINE_SCRIPTS_REF:-}" ]; then",
" git clone --progress --verbose --depth 1 --branch "$PIPELINE_SCRIPTS_REF" "$PIPELINE_SCRIPTS_REPOSITORY" "$PIPELINE_SCRIPTS_DIR"",
" else",
" git clone --progress --verbose --depth 1 "$PIPELINE_SCRIPTS_REPOSITORY" "$PIPELINE_SCRIPTS_DIR"",
" fi",
" fi",
" export ARTIFACTS_DIR="$PWD/.git/.artifacts"",
" # The artifacts directory might be left over from a previous run in",
" # the same Gitlab shell executor",
" rm -rf "$ARTIFACTS_DIR"",
" mkdir -p "$ARTIFACTS_DIR"",
" ",
"echo 123",
],
"tags": [
Expand Down
15 changes: 7 additions & 8 deletions src/gitlab/createCiConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,26 @@ export function createCiConfig(
timeout: "24 hours",
...task.gitlab.job,
script: [
`
...`
echo "This job is related to task ${task.id}. ${jobTaskInfoMessage}."

# The scripts repository might be left over from a previous run in the
# same Gitlab shell executor

rm -rf "$PIPELINE_SCRIPTS_DIR"

if [ "\${PIPELINE_SCRIPTS_REPOSITORY:-}" ]; then
if [ "\${PIPELINE_SCRIPTS_REF:-}" ]; then
git clone --progress --verbose --depth 1 --branch "$PIPELINE_SCRIPTS_REF" "$PIPELINE_SCRIPTS_REPOSITORY" "$PIPELINE_SCRIPTS_DIR"
else
git clone --progress --verbose --depth 1 "$PIPELINE_SCRIPTS_DIR"
git clone --progress --verbose --depth 1 "$PIPELINE_SCRIPTS_REPOSITORY" "$PIPELINE_SCRIPTS_DIR"
fi
fi
export ARTIFACTS_DIR="$PWD/${artifactsFolderPath}"
# The scripts repository might be left over from a previous run in the
# same Gitlab shell executor

rm -rf "$PIPELINE_SCRIPTS_DIR"
# The artifacts directory might be left over from a previous run in
# the same Gitlab shell executor
rm -rf "$ARTIFACTS_DIR"
mkdir -p "$ARTIFACTS_DIR"
`,
`.split("\n"),
task.command,
],
artifacts: {
Expand Down