Skip to content

Commit

Permalink
Add version prefix to build status files (#22126)
Browse files Browse the repository at this point in the history
  • Loading branch information
bnchrch committed Jan 31, 2023
1 parent a9d85e3 commit 1f2b6d6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def from_string(cls, string_value: Optional[str]) -> "BUILD_STATUSES":


def get_connector_build_output_url(connector_technical_name: str, connector_version: str) -> str:
return f"{CONNECTOR_BUILD_OUTPUT_URL}/{connector_technical_name}/{connector_version}.json"
return f"{CONNECTOR_BUILD_OUTPUT_URL}/{connector_technical_name}/version-{connector_version}.json"

def fetch_latest_build_status_for_connector_version(connector_technical_name: str, connector_version: str) ->BUILD_STATUSES:
"""Fetch the latest build status for a given connector version."""
Expand Down
2 changes: 1 addition & 1 deletion tools/ci_connector_ops/tests/test_qa_engine/test_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def test_fetch_latest_build_status_for_connector_version(mocker, connector_name,
mock_get = mocker.patch.object(requests, 'get', return_value=mock_response)

assert inputs.fetch_latest_build_status_for_connector_version(connector_name, connector_version) == expected_status
assert mock_get.call_args == call(f"{constants.CONNECTOR_BUILD_OUTPUT_URL}/{connector_name}/{connector_version}.json")
assert mock_get.call_args == call(f"{constants.CONNECTOR_BUILD_OUTPUT_URL}/{connector_name}/version-{connector_version}.json")

def test_fetch_latest_build_status_for_connector_version_invalid_status(mocker, caplog):
connector_name = "connectors/source-pokeapi"
Expand Down
6 changes: 5 additions & 1 deletion tools/status/report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ fi
BUCKET_WRITE_ROOT=/tmp/bucket_write_root
LAST_TEN_ROOT=/tmp/last_ten_root
SUMMARY_WRITE_ROOT=/tmp/summary_write_root
VERSION_PREFIX="version-"

DOCKER_VERSION=$(get_connector_version "$CONNECTOR")

Expand Down Expand Up @@ -65,8 +66,11 @@ function write_job_log() {

function pull_latest_job_logs() {
# pull the logs for the latest ten jobs for this connector
# note this is done by key as each log has a timestamp in the filename
# ensuring that the version specific runs are filtered out.
LAST_TEN_FILES=$(aws s3api list-objects-v2 --bucket "$BUCKET" \
--query "reverse(sort_by(Contents[?contains(Key, \`tests/history/$CONNECTOR\`)], &LastModified))[:10].Key" \
--prefix "tests/history/$CONNECTOR" \
--query "reverse(sort_by(Contents[?!contains(Key, \`$VERSION_PREFIX\`)], &Key))[:10].Key" \
--output=text)

rm -r $LAST_TEN_ROOT || true
Expand Down

0 comments on commit 1f2b6d6

Please sign in to comment.