Skip to content

Commit

Permalink
Merge pull request #206 from wttech/pkg-snapshot-ignore
Browse files Browse the repository at this point in the history
Package snapshot ignoring (edge case support)
  • Loading branch information
jaroslaw-pietraszek-vml authored Oct 11, 2023
2 parents 3ba629c + 481d2be commit bf4db37
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions examples/docker/src/aem/default/etc/aem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ instance:
package:
# Force re-uploading/installing of snapshot AEM packages (just built / unreleased)
snapshot_patterns: [ "**/*-SNAPSHOT.zip" ]
snapshot_ignored: false
# Use checksums to avoid re-deployments when snapshot AEM packages are unchanged
snapshot_deploy_skipping: true
# Disable following workflow launchers for a package deployment time only
Expand Down
2 changes: 2 additions & 0 deletions pkg/cfg/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ func (c *Config) setDefaults() {
v.SetDefault("instance.package.install_html.console", false)

v.SetDefault("instance.package.snapshot_deploy_skipping", true)
v.SetDefault("instance.package.snapshot_ignored", false)
v.SetDefault("instance.package.snapshot_patterns", []string{"**/*-SNAPSHOT.zip"})

v.SetDefault("instance.package.toggled_workflows", []string{})

v.SetDefault("instance.repo.property_change_ignored", []string{"jcr:created", "cq:lastModified", "transportPassword"})
Expand Down
8 changes: 5 additions & 3 deletions pkg/package_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ import (
type PackageManager struct {
instance *Instance

SnapshotDeploySkipping bool
UploadOptimized bool
InstallRecursive bool
InstallHTMLEnabled bool
InstallHTMLConsole bool
InstallHTMLStrict bool
SnapshotDeploySkipping bool
SnapshotIgnored bool
SnapshotPatterns []string
ToggledWorkflows []string
}
Expand All @@ -44,12 +45,13 @@ func NewPackageManager(res *Instance) *PackageManager {
return &PackageManager{
instance: res,

SnapshotDeploySkipping: cv.GetBool("instance.package.snapshot_deploy_skipping"),
UploadOptimized: cv.GetBool("instance.package.upload_optimized"),
InstallHTMLEnabled: cv.GetBool("instance.package.install_html.enabled"),
InstallHTMLConsole: cv.GetBool("instance.package.install_html.console"),
InstallHTMLStrict: cv.GetBool("instance.package.install_html.strict"),
InstallRecursive: cv.GetBool("instance.package.install_recursive"),
SnapshotDeploySkipping: cv.GetBool("instance.package.snapshot_deploy_skipping"),
SnapshotIgnored: cv.GetBool("instance.package.snapshot_ignored"),
SnapshotPatterns: cv.GetStringSlice("instance.package.snapshot_patterns"),
ToggledWorkflows: cv.GetStringSlice("instance.package.toggled_workflows"),
}
Expand Down Expand Up @@ -136,7 +138,7 @@ func (pm *PackageManager) findInternal(pid string) (*pkg.ListItem, error) {
}

func (pm *PackageManager) IsSnapshot(localPath string) bool {
return stringsx.MatchSome(pathx.Normalize(localPath), pm.SnapshotPatterns)
return !pm.SnapshotIgnored && stringsx.MatchSome(pathx.Normalize(localPath), pm.SnapshotPatterns)
}

func copyPackageDefaultFiles(targetTmpDir string, data map[string]any) error {
Expand Down
1 change: 1 addition & 0 deletions pkg/project/app_classic/aem/default/etc/aem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ instance:
package:
# Force re-uploading/installing of snapshot AEM packages (just built / unreleased)
snapshot_patterns: [ "**/*-SNAPSHOT.zip" ]
snapshot_ignored: false
# Use checksums to avoid re-deployments when snapshot AEM packages are unchanged
snapshot_deploy_skipping: true
# Disable following workflow launchers for a package deployment time only
Expand Down
1 change: 1 addition & 0 deletions pkg/project/app_cloud/aem/default/etc/aem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ instance:
package:
# Force re-uploading/installing of snapshot AEM packages (just built / unreleased)
snapshot_patterns: [ "**/*-SNAPSHOT.zip" ]
snapshot_ignored: false
# Use checksums to avoid re-deployments when snapshot AEM packages are unchanged
snapshot_deploy_skipping: true
# Disable following workflow launchers for a package deployment time only
Expand Down
1 change: 1 addition & 0 deletions pkg/project/instance/aem/default/etc/aem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ instance:
package:
# Force re-uploading/installing of snapshot AEM packages (just built / unreleased)
snapshot_patterns: [ "**/*-SNAPSHOT.zip" ]
snapshot_ignored: false
# Use checksums to avoid re-deployments when snapshot AEM packages are unchanged
snapshot_deploy_skipping: true
# Disable following workflow launchers for a package deployment time only
Expand Down

0 comments on commit bf4db37

Please sign in to comment.