govCMS / scaffold-tooling

6 stars 17 forks source link

Better output for 'ahoy ship-shape' #265

Closed AlexSkrypnyk closed 4 weeks ago

AlexSkrypnyk commented 1 year ago

Running ahoy ship-shape results in a very long output that can be seen below

Executing /app/vendor/bin/govcms-validate-modules...
GovCMS Validate :: Verify enabled modules

GovCMS Prepare XML report
Successfully generated govcms-validate-modules.xml

[success]: All modules are in expected states
Executing /app/vendor/bin/govcms-validate-active-permissions...
GovCMS Validate :: Disallowed permissions on active site

GovCMS Prepare XML report
Successfully generated govcms-validate-active-permissions.xml

[success]: No elevated permissions detected in configuration.
Executing /app/vendor/bin/govcms-validate-tfa...
GovCMS Validate :: Validate TFA config
[info]: TFA is enabled
[info]: TFA is required for authenticated users

GovCMS Prepare XML report
Successfully generated govcms-validate-tfa.xml

[success]: TFA is enabled and properly configured
Executing /app/vendor/bin/govcms-validate-profile...
GovCMS Validate :: Validate install profile
[info]: config/default/core.extension.yml is using the 'govcms' profile

GovCMS Prepare XML report
Successfully generated govcms-validate-profile.xml

[success]: 'govcms' profile is in use
Executing /app/vendor/bin/govcms-validate-permissions...
GovCMS Validate :: Disallowed permissions
[info]: config/default/user.role.anonymous.yml is valid
[info]: config/default/user.role.authenticated.yml is valid
[info]: config/default/user.role.civictheme_content_approver.yml is valid
[info]: config/default/user.role.civictheme_content_author.yml is valid
[info]: config/default/user.role.civictheme_site_administrator.yml is valid

GovCMS Prepare XML report
Successfully generated govcms-validate-permissions.xml

[success]: No elevated permissions detected in configuration.
Executing /app/vendor/bin/govcms-validate-platform-yml...
GovCMS Validate :: Yaml lint platform files

 [OK] All 1 YAML files contain valid syntax.                                    

 [OK] All 1 YAML files contain valid syntax.                                    

 [OK] All 1 YAML files contain valid syntax.                                    

 [OK] All 1 YAML files contain valid syntax.            

---------------------------------------------------
THIS REPEATS FOR 2000 LINES ON THE SITE WITH CONFIG                         
---------------------------------------------------

GovCMS Prepare XML report
Successfully generated govcms-validate-theme-yml.xml

[success]: No YAML issues in theme files.
Executing /app/vendor/bin/govcms-validate-active-tfa...
GovCMS Validate :: Validate TFA config on active site
[info]: TFA is enabled
[info]: TFA is required for authenticated users

GovCMS Prepare XML report
Successfully generated govcms-validate-active-tfa.xml

[success]: TFA is actively enabled and properly configured
Executing /app/vendor/bin/govcms-validate-active-profile...
GovCMS Validate :: Validate profile on active site
[success]: 'govcms' profile is in use
Executing /app/vendor/bin/govcms-validate-theme-modules...
GovCMS Validate :: Scan themes for modules
[info]: web/themes/contrib/adminimal_theme/adminimal_theme.info.yml is valid
[info]: web/themes/custom/custom/mytheme/mytheme.info.yml is valid
[info]: web/themes/custom/custom/myothertheme/myothertheme.info.yml is valid

GovCMS Prepare XML report
Successfully generated govcms-validate-prevent-theme-modules.xml

[success]: No modules detected.
Executing /app/vendor/bin/govcms-validate-illegal-files...
GovCMS Validate :: Illegal files

GovCMS Prepare XML report
Successfully generated govcms-illegal-files.xml

[success]: No illegal files.
Executing /app/vendor/bin/govcms-validate-active-modules...
GovCMS Validate :: Active modules validation

GovCMS Prepare XML report
Successfully generated govcms-validate-active-permissions.xml

[success]: All modules are in expected states
Executing /app/vendor/bin/govcms-validate-php-functions...
GovCMS Validate :: Banned PHP function list

 [OK] No errors                                                                 

Successfully generated govcms-validate-php-functions.xml
[success]: No banned function detected in code.
XML files have been generated at ./.ship-shape:
  .ship-shape//govcms-validate-platform.xml
  .ship-shape//govcms-validate-active-permissions.xml
  .ship-shape//govcms-validate-php-functions.xml
  .ship-shape//govcms-validate-modules.xml
  .ship-shape//govcms-validate-active-tfa.xml
  .ship-shape//govcms-illegal-files.xml
  .ship-shape//govcms-validate-profile.xml
  .ship-shape//govcms-validate-tfa.xml
  .ship-shape//govcms-validate-prevent-theme-modules.xml
  .ship-shape//govcms-validate-theme-yml.xml
  .ship-shape//govcms-validate-permissions.xml

During forklifts, this needs to be run over and over again, until the DB and config are in the good "shape".

Is it possible to:

  1. Batch the checking of config yamls and just print success/error at the end
  2. Add visual separation between completed and the next task - a new line or a separator.
  3. Have an overall status SUCCESS/FAILURE add at the end.
steveworley commented 4 weeks ago

Hey @AlexSkrypnyk — sorry for the delay in responding here. We've historically not been great at this. I just wanted to provide an update. Shipshape supports a number of different output formats which when you're running this locally can be used to help this.

ahoy ship-shape --output table|json|junit --error-code

This should change the output to something more readable (or something that can be easily passed in a standard format) and should then present an error code based on the shipshape configuration if the site passes or not. We can look to make the output better, but this would be better managed via Shipshape directly .