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

ci: improve logging for tools build script #1128

Merged
merged 7 commits into from
Nov 30, 2022

Conversation

derberg
Copy link
Member

@derberg derberg commented Nov 24, 2022

related to #940 (comment)

@netlify
Copy link

netlify bot commented Nov 24, 2022

Deploy Preview for asyncapi-website ready!

Name Link
🔨 Latest commit 36143b2
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/638764477d9bb500082485f5
😎 Deploy Preview https://deploy-preview-1128--asyncapi-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions
Copy link

github-actions bot commented Nov 24, 2022

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 45
🟠 Accessibility 88
🟠 Best practices 83
🟢 SEO 100
🔴 PWA 30

Lighthouse ran on https://deploy-preview-1128--asyncapi-website.netlify.app/

Comment on lines 68 to 71
console.log('Invalid .asyncapi-tool file.');
console.log(`Located in: ${tool.repository.html_url}`);
console.log('Validation errors:', JSON.stringify(validate.errors, null, 2));
console.log('Not failing, dropping errors for further investigation');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe console.error will be better?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, console.error is better but I think what we discussed in the previous meetings that we should notify about each error in the Slack notification channel. That functionality is left here. Will soon add it to the upcoming PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, getting stuff to slack will be tricky, as normal flow will not work. We will need to use GitHub Action core library to set output for GH Action workflow, so we can react and drop message to slack. I can add it in this PR if ya want

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if you want to use Slack notifications, I would suggest you to use REST API of Slack (if exists 😅) as the log messages are present in the script files and making a API call from that script file to create notifications is lot more easier and reliable instead of using Github Actions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference, you can read this documentation - https://api.slack.com/messaging/sending

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but GitHub action that we would plug in is using Slack REST API. What is the point of writing own logic?

we can grab log message from script, output to GH Action, and push it to slack, formatted as we want -> https://github.com/asyncapi/community/blob/master/.github/workflows/notify-tsc-members-mention.yml#L82-L86

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want you can add integration with slack. If not, you can do it in another PR :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now that I think about it, better would be to add integration later after tools view is released because we will get slack notifications now that will annoy us (there is already one file that is invalid in one repo). I'll add issue so we don't forget

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akshatnema I see you already made changes to console

@akshatnema @magicmatatjahu approve?

console.log("Repository: " + tool.repository.html_url)
console.log("Error: " + validate.errors)
console.error('Invalid .asyncapi-tool file.');
console.error(`Located in: ${tool.html_url}`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking code, it should be probably:

Suggested change
console.error(`Located in: ${tool.html_url}`);
console.error(`Located in: ${tool.repository.html_url}`);

or am I wrong?

Copy link
Member

@akshatnema akshatnema Nov 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, from my perspective, certain users are making .asyncapi-tool files inside any subdirectories. If we want to locate the wrong file, it may occur that we get into trouble finding the file inside the repository sub-directories. Hence, using tool.html_url is the best link to directly hop into the file in the respective repository to see the errors, instead using the repository's URL. WDYT @magicmatatjahu @derberg ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akshatnema you are right, tool.html_url provides direct URL to the file

@magicmatatjahu changed

folks, please approve

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I was looking at the code and we used a different field. Approved :)

Co-authored-by: Maciej Urbańczyk <[email protected]>
magicmatatjahu
magicmatatjahu previously approved these changes Nov 29, 2022
@akshatnema
Copy link
Member

/rtm

@asyncapi-bot asyncapi-bot merged commit bd55b7f into asyncapi:master Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants