Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build artifacts for failed builds #3949

Open
3 tasks done
clemblanco opened this issue Jul 12, 2024 · 12 comments
Open
3 tasks done

Build artifacts for failed builds #3949

clemblanco opened this issue Jul 12, 2024 · 12 comments
Labels
feature-request New feature or request

Comments

@clemblanco
Copy link

clemblanco commented Jul 12, 2024

Before opening, please confirm:

Amplify Hosting feature

E2E Cypress tests

Is your feature request related to a problem? Please describe:

It looks like with Amplify 2, build artifacts can only be downloaded for successful builds, not failing builds. However, they are the most useful to us to troubleshoot things when our E2E tests are failing before deploying, therefore we need to be able to access them for failed builds too.

Describe how you'd like this feature to work

Same as for successful builds but for failed builds too.

image
image

We can even see in the logs for failed builds that the artifacts are indeed uploaded to your S3 bucket https://aws-amplify-prod-[region]-artifacts.s3.[region].amazonaws.com/[app_id]/[branch]/000000[build_number]/BUILD/artifacts.zip, so it's not like they were not existing at all.

image

@clemblanco clemblanco added the feature-request New feature or request label Jul 12, 2024
Copy link

This has been identified as a feature request. If this feature is important to you, we strongly encourage you to give a 👍 reaction on the request. This helps us prioritize new features most important to you. Thank you!

@clemblanco
Copy link
Author

It's been a month and a half. Any update on this one?

@mauerbac
Copy link
Member

@clemblanco right now we only upload build artifacts if the build succeeds or if it fails due to a bundle size error .

What use case are you looking for?

@clemblanco
Copy link
Author

@mauerbac well if a build fails because of some e2e tests failing we want to be able to download our artifacts generated by Cypress such as screenshots and videos. This used to be possible with the first Amplify console. Not anymore unless if we use the AWS CLI directly, meaning such files are still generated and uploaded to your own private S3. They just aren't offered to download directly from the console anymore which is very annoying.

@mauerbac
Copy link
Member

ah, understood -- sorry. You want to download test artifacts easily in the Gen2 UI . Let me share this with our console team

@mauerbac
Copy link
Member

hi @clemblanco - i spoke to the team. There should be no difference in functionality between the new and old console UI as it pertains to this feature. If you don't see the download button that means there is some issue preventing us for giving you the logs.

Either 1/ you have your own amplify.yml file or you didn't deploy through the console so app.buildSpec was not setup

The solution would be to take whatever you have in your own custom build spec and paste it into the Build Settings section for the app in the console

@clemblanco
Copy link
Author

@mauerbac it's the exact same amplify.yml and when we analyse the logs we can see Amplify uploading the same files to your S3 bucket which is how we figured out we could maybe use the AWS CLI to generate some signed URLs to directly download these files.

I've just tried pasting it into the console with no luck. The artifacts from the failing test phase are no longer accessible whatsoever, only standard logs are.

I have root access on my account so I don't think it's a permission issue.

@clemblanco
Copy link
Author

This is what I'm referring to:

artifacts>files
The generated artifacts (screenshots and videos) available for download.

Source: https://docs.aws.amazon.com/amplify/latest/userguide/running-tests.html

@clemblanco
Copy link
Author

If you don't see the download button that means there is some issue preventing us for giving you the logs.

I do see the button it's just only giving me text logs which I already have in the console UI.

@clemblanco
Copy link
Author

We don't have a custom buildspec.yml file. Only an amplify.yml one. Which we tried to copy paste into the console already.

@mauerbac
Copy link
Member

ah, ok - i see. The issue is probably in the amplify.yml file. Amplify Console detects whether an app has been configured to run Cypress tests by searching for one the following phases in the app’s build spec: preTest: , test:, postTest:

preTest
Install the dependencies required to run Cypress tests. Amplify Hosting uses mochawesome to generate a report to view your test results and wait-on to set up the localhost server during the build.

test
Run cypress commands to perform tests using mochawesome.

postTest
The mochawesome report is generated from the output JSON. Note that if you are using Yarn, you must run this command in silent mode to generate the mochawesome report. For Yarn, you can use the following command.

You may need to edit your file with one of these commands. If you need further help, could you contact me with your account number + appId + build id and ill take a look. You can DM me on Twitter, Discord or amazon email with my username on github

@clemblanco
Copy link
Author

We already have these in our amplify.yml

I will DM you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants