Skip to content

publish-development-docs.sh: || true masks aws s3 ls failures, risking truncated versions.json #2240

Description

@spike-rabbit

Summary

In tools/release/publish-development-docs.sh, the S3 listing pipeline ends with || true:

aws s3 ls "s3://${VERSIONED_BUCKET_NAME}/" | grep "PRE v" | awk '{print $2}' | sed 's/\/$//' | sed 's/^v//' > s3-versions.txt || true

The script runs with set -euo pipefail. The || true is only needed so that grep returning exit 1 (no PRE v matches) does not abort the script. However, because it is attached to the whole pipeline, it also masks a failure of aws s3 ls itself (expired credentials, network error, missing permissions).

Impact

When aws s3 ls fails silently:

  1. s3-versions.txt ends up empty.
  2. generate-versions.js produces a versions.json with only the Development and root entries — all released versions dropped.
  3. The script then uploads that file over the live s3://simpl-element-release/versions.json, breaking the version selector on the production documentation site.

Suggested fix

Split the listing from the filtering so a CLI failure aborts the script, while || true still only covers the harmless "grep found nothing" case:

aws s3 ls "s3://${VERSIONED_BUCKET_NAME}/" > s3-raw.txt
grep "PRE v" s3-raw.txt | awk '{print $2}' | sed 's/\/$//' | sed 's/^v//' > s3-versions.txt || true
rm s3-raw.txt

Notes

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions