Skip to content

Commit

Permalink
Convince GitLab not to crop collapsed multiline strings (paritytech#3971
Browse files Browse the repository at this point in the history
)

Use of `- >` instead of `- |` workarounds GitLab quirk when it crops
collapsed multiline `script:` section commands in its CI job logs.
This PR also fixes `- |` based `script:` steps to behave properly after
`- >` conversion.

Resolves https://github.com/paritytech/ci_cd/issues/972.
  • Loading branch information
rcny authored Apr 4, 2024
1 parent 3836376 commit ebdca15
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 43 deletions.
6 changes: 3 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ default:
- cp $FL_FORKLIFT_CONFIG ~/.forklift/config.toml
- shopt -s expand_aliases
- export PATH=$PATH:$(pwd)
- |
- >
if [ "$FORKLIFT_BYPASS" != "true" ]; then
echo "FORKLIFT_BYPASS not set, creating alias cargo='forklift cargo'"
alias cargo="forklift cargo"
echo "FORKLIFT_BYPASS not set, creating alias cargo='forklift cargo'";
alias cargo="forklift cargo";
fi
#
- echo "FL_FORKLIFT_VERSION ${FL_FORKLIFT_VERSION}"
Expand Down
28 changes: 14 additions & 14 deletions .gitlab/pipeline/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,26 +105,26 @@ build-rustdoc:
- mv ./target/doc ./crate-docs
# Inject Simple Analytics (https://www.simpleanalytics.com/) privacy preserving tracker into
# all .html files
- |
- >
inject_simple_analytics() {
local path="$1"
local script_content="<script async defer src=\"https://apisa.parity.io/latest.js\"></script><noscript><img src=\"https://apisa.parity.io/latest.js\" alt=\"\" referrerpolicy=\"no-referrer-when-downgrade\" /></noscript>"
local path="$1";
local script_content="<script async defer src=\"https://apisa.parity.io/latest.js\"></script><noscript><img src=\"https://apisa.parity.io/latest.js\" alt=\"\" referrerpolicy=\"no-referrer-when-downgrade\" /></noscript>";
# Function that inject script into the head of an html file using sed.
process_file() {
local file="$1"
echo "Adding Simple Analytics script to $file"
sed -i "s|</head>|$script_content</head>|" "$file"
}
export -f process_file
# xargs runs process_file in seperate shells without access to outer variables.
# to make script_content available inside process_file, export it as an env var here.
export script_content
local file="$1";
echo "Adding Simple Analytics script to $file";
sed -i "s|</head>|$script_content</head>|" "$file";
};
export -f process_file;
# xargs runs process_file in separate shells without access to outer variables.
# make script_content available inside process_file, export it as an env var here.
export script_content;
# Modify .html files in parallel using xargs, otherwise it can take a long time.
find "$path" -name '*.html' | xargs -I {} -P "$(nproc)" bash -c 'process_file "$@"' _ {}
}
inject_simple_analytics "./crate-docs"
find "$path" -name '*.html' | xargs -I {} -P "$(nproc)" bash -c 'process_file "$@"' _ {};
};
inject_simple_analytics "./crate-docs";
- echo "<meta http-equiv=refresh content=0;url=polkadot_sdk_docs/index.html>" > ./crate-docs/index.html

build-implementers-guide:
Expand Down
29 changes: 13 additions & 16 deletions .gitlab/pipeline/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,23 +104,20 @@ check-toml-format:
- .docker-env
- .test-pr-refs
script:
- |
export RUST_LOG=remote-ext=debug,runtime=debug
echo "---------- Downloading try-runtime CLI ----------"
curl -sL https://github.com/paritytech/try-runtime-cli/releases/download/v0.5.4/try-runtime-x86_64-unknown-linux-musl -o try-runtime
chmod +x ./try-runtime
echo "Using try-runtime-cli version:"
./try-runtime --version
echo "---------- Building ${PACKAGE} runtime ----------"
time cargo build --release --locked -p "$PACKAGE" --features try-runtime
echo "---------- Executing on-runtime-upgrade for ${NETWORK} ----------"
- export RUST_LOG=remote-ext=debug,runtime=debug
- echo "---------- Downloading try-runtime CLI ----------"
- curl -sL https://github.com/paritytech/try-runtime-cli/releases/download/v0.5.4/try-runtime-x86_64-unknown-linux-musl -o try-runtime
- chmod +x ./try-runtime
- echo "Using try-runtime-cli version:"
- ./try-runtime --version
- echo "---------- Building ${PACKAGE} runtime ----------"
- time cargo build --release --locked -p "$PACKAGE" --features try-runtime
- echo "---------- Executing on-runtime-upgrade for ${NETWORK} ----------"
- >
time ./try-runtime ${COMMAND_EXTRA_ARGS} \
--runtime ./target/release/wbuild/"$PACKAGE"/"$WASM" \
on-runtime-upgrade --disable-spec-version-check --checks=all ${SUBCOMMAND_EXTRA_ARGS} live --uri ${URI}
sleep 5
--runtime ./target/release/wbuild/"$PACKAGE"/"$WASM" \
on-runtime-upgrade --disable-spec-version-check --checks=all ${SUBCOMMAND_EXTRA_ARGS} live --uri ${URI}
- sleep 5

# Check runtime migrations for Parity managed relay chains
check-runtime-migration-westend:
Expand Down
14 changes: 7 additions & 7 deletions .gitlab/pipeline/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,17 @@ trigger_workflow:
artifacts: true
script:
- echo "Triggering workflow"
- |
- >
for benchmark in $(ls charts/*.json); do
export bencmark_name=$(basename $benchmark)
echo "Benchmark: $bencmark_name"
export benchmark_dir=$(echo $bencmark_name | sed 's/\.json//')
export benchmark_name=$(basename $benchmark);
echo "Benchmark: $benchmark_name";
export benchmark_dir=$(echo $benchmark_name | sed 's/\.json//');
curl -q -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/repos/paritytech/${CI_PROJECT_NAME}/actions/workflows/subsystem-benchmarks.yml/dispatches \
-d '{"ref":"refs/heads/master","inputs":{"benchmark-data-dir-path":"'$benchmark_dir'","output-file-path":"'$bencmark_name'"}}'
sleep 300
https://api.github.com/repos/paritytech/${CI_PROJECT_NAME}/actions/workflows/subsystem-benchmarks.yml/dispatches \
-d "{\"ref\":\"refs/heads/master\",\"inputs\":{\"benchmark-data-dir-path\":\"$benchmark_dir\",\"output-file-path\":\"$benchmark_name\"}}";
sleep 300;
done
allow_failure: true

Expand Down
6 changes: 3 additions & 3 deletions .gitlab/pipeline/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test-linux-stable:
- echo "Node index - ${CI_NODE_INDEX}. Total amount - ${CI_NODE_TOTAL}"
# add experimental to features after https://github.com/paritytech/substrate/pull/14502 is merged
# "upgrade_version_checks_should_work" is currently failing
- |
- >
time cargo nextest run \
--workspace \
--locked \
Expand All @@ -34,7 +34,7 @@ test-linux-stable:
# Upload tests results to Elasticsearch
- echo "Upload test results to Elasticsearch"
- cat target/nextest/default/junit.xml | xq . > target/nextest/default/junit.json
- |
- >
curl -v -XPOST --http1.1 \
-u ${ELASTIC_USERNAME}:${ELASTIC_PASSWORD} \
https://elasticsearch.parity-build.parity.io/unit-tests/_doc/${CI_JOB_ID} \
Expand Down Expand Up @@ -87,7 +87,7 @@ test-linux-stable-runtime-benchmarks:
# script:
# # Build all but only execute 'runtime' tests.
# - echo "Node index - ${CI_NODE_INDEX}. Total amount - ${CI_NODE_TOTAL}"
# - |
# - >
# time cargo nextest run \
# --workspace \
# --locked \
Expand Down

0 comments on commit ebdca15

Please sign in to comment.