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

Initial commit for new logging output #3150

Merged

Conversation

cdunbar13
Copy link
Contributor

This PR adds an output to the Packer module that prints a custom gcloud logging command of the format

gcloud logging --project read 'logName=("projects//logs/GCEMetadataScripts" OR "projects//logs/google_metadata_script_runner") AND resource.labels.instance_id=<instance #>' --format="table(timestamp, resource.labels.instance_id, jsonPayload.message)" --order=asc

when Packer fails during the startup scripts. It also updates packer to create a instance name variable for the instance so that can be more easily tracked in the module. It varies from the command in the README in that it should not need the freshness option as it is specific to one instance. It also does not look for "^startup-script: " as that can be a bit too specific of a query.

This PR also updates the golden copies.

This was tested on a simple Packer blueprint that introduced an script that only ran exit 1 and cause the Packer module to end with an error. It was also tested with a clean build to confirm no new issues were introduced.

@cdunbar13 cdunbar13 added the release-module-improvements Added to release notes under the "Module Improvements" heading. label Oct 21, 2024
@cdunbar13 cdunbar13 requested a review from tpdownes October 21, 2024 16:30
@cdunbar13 cdunbar13 force-pushed the packer-add-specific-command branch 3 times, most recently from b976c73 to 227dc7a Compare October 21, 2024 17:27
@tpdownes tpdownes assigned cdunbar13 and unassigned tpdownes Oct 21, 2024
@cdunbar13 cdunbar13 force-pushed the packer-add-specific-command branch 2 times, most recently from 73fd5fd to ffad74c Compare October 21, 2024 18:54
@cdunbar13 cdunbar13 requested a review from tpdownes October 21, 2024 18:55
@cdunbar13 cdunbar13 assigned tpdownes and unassigned cdunbar13 Oct 21, 2024
@cdunbar13 cdunbar13 force-pushed the packer-add-specific-command branch from ffad74c to 7674060 Compare October 22, 2024 14:22
@tpdownes tpdownes assigned cdunbar13 and unassigned tpdownes Oct 22, 2024
@cdunbar13 cdunbar13 merged commit a9301fb into GoogleCloudPlatform:develop Oct 23, 2024
17 of 54 checks passed
@cdunbar13 cdunbar13 deleted the packer-add-specific-command branch October 23, 2024 13:37
@rohitramu rohitramu mentioned this pull request Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-module-improvements Added to release notes under the "Module Improvements" heading.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants