Skip to content
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
35 changes: 33 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ runs:
set -euo pipefail
ACTION_DIR="${{ github.action_path }}"
ARMOR_BINS_PATH="$(cat "${{ github.action_path }}/.armor_bins_path")"
PROJECT="${{ github.repository }}"
PROJECT_URL="${{ github.server_url }}/${{ github.repository }}"
BRANCH="${{ inputs.branch-name }}"
GITHUB_EVENT="${{ github.event_name }}"
if [[ "$GITHUB_EVENT" == pull_request* ]]; then
Expand All @@ -170,7 +170,7 @@ runs:
-e REPORT_FORMAT="${REPORT_FORMAT}" \
-e LOG_LEVEL="${LOG_LEVEL}" \
-e DUMP_AST_DIFF="${DUMP_AST_DIFF}" \
-e PROJECT="${PROJECT}" \
-e PROJECT_URL="${PROJECT_URL}" \
-e BRANCH="${BRANCH}" \
-e GITHUB_EVENT="${GITHUB_EVENT}" \
-e PR_NUMBER="${PR_NUMBER}" \
Expand Down Expand Up @@ -214,6 +214,37 @@ runs:
echo "Overall status: $STATUS"
echo "res=$STATUS" >> "$GITHUB_OUTPUT"

- name: Upload folder to S3
shell: bash
run: |
set -e
FOLDER="${{ steps.run-armor.outputs.out-root }}"
BUCKET="s3://qli-stg-armor-gh-artifacts"
YYYY="$(date -u +'%Y')"
MM="$(date -u +'%m')"
DD="$(date -u +'%d')"
HH="$(date -u +'%H')"
HOST="$(printf '%s' "${{ github.server_url }}" | sed -E 's#^[a-zA-Z]+://##; s#/.*$##')"
PREFIX="${YYYY}/${MM}/${DD}/${HH}/${HOST}/${{ github.repository }}/${GITHUB_REF_NAME}/${{ github.run_id }}/files"
echo "Uploading artifacts to Destination: ${BUCKET}/${PREFIX}"
set +e
ERR_FILE="$(mktemp)"
aws s3 cp "${FOLDER}" "${BUCKET}/${PREFIX}" \
--recursive \
--content-type "application/octet-stream" \
--only-show-errors \
2> "${ERR_FILE}"
rc=$?
set -e
if [[ ${rc} -eq 0 ]]; then
echo "S3 upload succeeded."
else
reason="$(cat "${ERR_FILE}")"
echo "::error :: S3 upload FAILED (rc=${rc})."
echo "::error :: Reason: ${reason:-No error output captured}"
fi
rm -f "${ERR_FILE}"

- name: Prepare ARMOR summary
if: steps.intersection.outputs.has-intersection == 'true'
id: prepare-comment
Expand Down
6 changes: 3 additions & 3 deletions action_script/run_armor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ BASE_PATH="${1:-}"; HEAD_PATH="${2:-}"; INTERSECTION_FILE="${3:-}"; ARMOR_BINS_P
[[ -d "$HEAD_PATH" ]] || die "HEAD_PATH not a directory"
[[ -f "$INTERSECTION_FILE" ]] || die "Intersection file not found"

PROJECT="${PROJECT:-unknown}"
PROJECT_URL="${PROJECT_URL:-unknown}"
BRANCH="${BRANCH:-unknown}"
GITHUB_EVENT="${GITHUB_EVENT:-unknown}"
PR_NUMBER="${PR_NUMBER:-}"
Expand Down Expand Up @@ -119,7 +119,7 @@ sort -u -o "$INCOMPATIBLE_NONBLOCKING" "$INCOMPATIBLE_NONBLOCKING"
headers_array="$(jq -s '.' "$METADATA_NDJSON")"
ts="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
jq -n \
--arg project "$PROJECT" \
--arg project_url "$PROJECT_URL" \
--arg branch "$BRANCH" \
--arg event "$GITHUB_EVENT" \
--argjson pr "$( [[ -n "$PR_NUMBER" ]] && printf '%s' "$PR_NUMBER" || printf 'null' )" \
Expand All @@ -128,7 +128,7 @@ jq -n \
--arg base_sha "$BASE_SHA" \
--arg artifacts "$workflow_url#artifacts" \
--argjson headers "$headers_array" \
'{project:$project, branch:$branch, github_event:$event, pr_number:$pr, timestamp:$timestamp, head_sha:$head_sha, base_sha:$base_sha, artifacts:$artifacts, headers:$headers}' \
'{project_url:$project_url, branch:$branch, github_event:$event, pr_number:$pr, timestamp:$timestamp, head_sha:$head_sha, base_sha:$base_sha, artifacts:$artifacts, headers:$headers}' \
> "${OUT_ROOT}/metadata.json"

overall_status="success"
Expand Down
Loading