Is it possible to get the test package upload ARN for a run?

0

Is it possible to get the test package upload ARN for a run?

I can't find a way to do this via the command-line interface. Have I overlooked something?

pactlq
gefragt vor 5 Jahren246 Aufrufe
4 Antworten
0

Currently this is not a supported use case.

Thank you for the request, we will get back to you once this is supported.

beantwortet vor 5 Jahren
0

Thank you. I wanted an automated way to find test package uploads that were unused (because associated runs had been deleted).

pactlq
beantwortet vor 5 Jahren
0

Hi again,

Quick follow up, a colleague pointed out a temporary work around. You could automate AWS Cloudtrail to get the test package ARN given that you have the the run ARN, and jq installed on your computer.

Try the following command, just replace YOUR_RUN_ARN_HERE with your run ARN

aws cloudtrail lookup-events --lookup-attributes  AttributeKey=EventName,AttributeValue=ScheduleRun --region us-west-2 --query Events[].CloudTrailEvent | jq '.[] | fromjson | select(.responseElements.run.arn == "YOUR_RUN_ARN_HERE" ) | .requestParameters.test.testPackageArn'

Hope this helps.

==== Edit ====
Fixed command typo

Edited by: scotttaws on Mar 13, 2019 12:50 PM

Edited by: scotttaws on Mar 13, 2019 12:53 PM

beantwortet vor 5 Jahren
0

Thanks! This works for me.

Also, to follow up, this is the code that got me the list of unused test package uploads:

readonly region=us-west-2
readonly project=
readonly runs=$(aws devicefarm list-runs --arn ${project} --output text --query 'runs[].[arn]')
readonly run_test_package=$(aws cloudtrail lookup-events \
  --lookup-attributes AttributeKey=EventName,AttributeValue=ScheduleRun \
  --region ${region} \
  --query Events[].CloudTrailEvent \
  | jq -r '.[] | fromjson | select(.requestParameters.projectArn == "'${project}'" ) | "\(.responseElements.run.arn)\t\(.requestParameters.test.testPackageArn)"')
grep -vF "${runs}" <<< "${run_test_package}" | cut -f 2

Edited by: pactlq on Mar 13, 2019 2:50 PM

Edited by: pactlq on Mar 13, 2019 3:07 PM

pactlq
beantwortet vor 5 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen