mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merged with master
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -4,7 +4,7 @@
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<version>3.1.0-SNAPSHOT</version>
|
||||
<name>Alfresco Governance Services</name>
|
||||
|
||||
<url>http://www.alfresco.org/</url>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services</artifactId>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<version>3.1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<licenses>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-automation</artifactId>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<version>3.1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services</artifactId>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<version>3.1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<licenses>
|
||||
|
@@ -2,14 +2,14 @@
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>alfresco-governance-services-community-repo</artifactId>
|
||||
<name>Alfresco Governance Services Community Repo</name>
|
||||
<description>Alfresco Governance Services Community Repository Extension</description>
|
||||
<name>AGS Repo</name>
|
||||
<description>Alfresco Governance Services Repository Extension</description>
|
||||
<packaging>amp</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community</artifactId>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<version>3.1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
@@ -709,4 +709,4 @@
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
</project>
|
@@ -27,6 +27,8 @@
|
||||
|
||||
package org.alfresco.module.org_alfresco_module_rm.patch.compatibility;
|
||||
|
||||
import static org.alfresco.repo.module.ModuleVersionNumber.VERSION_ZERO;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.patch.ModulePatchExecuterImpl;
|
||||
@@ -117,49 +119,63 @@ public abstract class ModulePatchComponent extends AbstractModuleComponent
|
||||
@Override
|
||||
protected void executeInternal()
|
||||
{
|
||||
ModuleVersionNumber moduleInstalledVersionNumber = getModuleVersionNumber(REGISTRY_PROPERTY_INSTALLED_VERSION);
|
||||
ModuleVersionNumber moduleCurrentVersionNumber = getModuleVersionNumber(REGISTRY_PROPERTY_CURRENT_VERSION);
|
||||
|
||||
String moduleName = getName();
|
||||
//Get the new module version
|
||||
String moduleId = modulePatchExecuter.getModuleId();
|
||||
ModuleVersionNumber moduleNewVersionNumber = moduleService.getModule(moduleId).getModuleVersionNumber();
|
||||
|
||||
if (isVersionLaterThan(moduleInstalledVersionNumber, moduleCurrentVersionNumber))
|
||||
// Get the module details from the registry
|
||||
ModuleVersionNumber moduleCurrentVersionNumber = getModuleVersionNumber(REGISTRY_PROPERTY_CURRENT_VERSION,
|
||||
moduleId);
|
||||
// Get the module patch component name
|
||||
String moduleName = getName();
|
||||
if (moduleCurrentVersionNumber.equals(VERSION_ZERO) ||
|
||||
moduleCurrentVersionNumber.equals(moduleNewVersionNumber)) // No previous record of it
|
||||
{
|
||||
LOGGER.info("Module patch component '{}' is skipped for upgrade from version {} to version {}",
|
||||
moduleName, moduleInstalledVersionNumber, moduleCurrentVersionNumber);
|
||||
LOGGER.info("Module patch component '{}' is skipped, no previous version found.", moduleName);
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
if (isVersionLaterThan(moduleCurrentVersionNumber, moduleNewVersionNumber))
|
||||
{
|
||||
LOGGER.info("Module patch component '{}' is executing ...", moduleName);
|
||||
|
||||
// execute path within an isolated transaction
|
||||
retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
|
||||
LOGGER.info("Module patch component '{}' is skipped for upgrade from version {} to version {}",
|
||||
moduleName, moduleCurrentVersionNumber, moduleNewVersionNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
@Override
|
||||
public Void execute()
|
||||
LOGGER.info("Module patch component '{}' is executing ...", moduleName);
|
||||
|
||||
// execute path within an isolated transaction
|
||||
retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
|
||||
|
||||
{
|
||||
behaviourFilter.disableBehaviour();
|
||||
try
|
||||
@Override
|
||||
public Void execute()
|
||||
{
|
||||
executePatch();
|
||||
behaviourFilter.disableBehaviour();
|
||||
try
|
||||
{
|
||||
executePatch();
|
||||
}
|
||||
finally
|
||||
{
|
||||
behaviourFilter.enableBehaviour();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
behaviourFilter.enableBehaviour();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}, false, true);
|
||||
}, false, true);
|
||||
|
||||
LOGGER.info(" ... completed module patch '{}'", moduleName);
|
||||
|
||||
} catch (Exception exception)
|
||||
{
|
||||
// record the exception otherwise it gets swallowed
|
||||
LOGGER.info(" ... error encountered. {}", exception.getMessage(), exception);
|
||||
throw exception;
|
||||
LOGGER.info(" ... completed module patch '{}'", moduleName);
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
// record the exception otherwise it gets swallowed
|
||||
LOGGER.info(" ... error encountered. {}", exception.getMessage(), exception);
|
||||
throw exception;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -167,14 +183,21 @@ public abstract class ModulePatchComponent extends AbstractModuleComponent
|
||||
/**
|
||||
* Helper method to get the ModuleVersionNumber.
|
||||
*/
|
||||
private ModuleVersionNumber getModuleVersionNumber(String registryProperty)
|
||||
private ModuleVersionNumber getModuleVersionNumber(String registryProperty, String moduleId)
|
||||
{
|
||||
String moduleId = modulePatchExecuter.getModuleId();
|
||||
RegistryKey moduleKeyVersion = new RegistryKey(ModuleComponentHelper.URI_MODULES_1_0,
|
||||
new String[]{REGISTRY_PATH_MODULES, moduleId, registryProperty});
|
||||
Serializable moduleVersion = this.registryService.getProperty(moduleKeyVersion);
|
||||
|
||||
return new ModuleVersionNumber(moduleVersion.toString());
|
||||
|
||||
if (moduleVersion == null)
|
||||
{
|
||||
return VERSION_ZERO;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ModuleVersionNumber(moduleVersion.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -182,22 +205,27 @@ public abstract class ModulePatchComponent extends AbstractModuleComponent
|
||||
* patches.
|
||||
*
|
||||
*/
|
||||
private boolean isVersionLaterThan(ModuleVersionNumber installedModuleVersionNumber,
|
||||
ModuleVersionNumber currentModuleVersionNumber)
|
||||
private boolean isVersionLaterThan(ModuleVersionNumber moduleCurrentVersionNumber,
|
||||
ModuleVersionNumber moduleNewVersionNumber)
|
||||
{
|
||||
// assume that the v2.0 and v2.1 patches should be run
|
||||
boolean versionLaterThan = false;
|
||||
|
||||
// if this is an upgrade as opposed to a fresh install
|
||||
if (installedModuleVersionNumber.compareTo(currentModuleVersionNumber) != 0)
|
||||
if (moduleCurrentVersionNumber.compareTo(moduleNewVersionNumber) < 0)
|
||||
{
|
||||
// if the installed version is later than the minimum version number of this patch
|
||||
ModuleVersionNumber minVersion = this.getAppliesFromVersionNumber();
|
||||
if (installedModuleVersionNumber.compareTo(minVersion) >= 0)
|
||||
if (moduleCurrentVersionNumber.compareTo(minVersion) >= 0)
|
||||
{
|
||||
versionLaterThan = true;
|
||||
}
|
||||
}
|
||||
// v2.0 and v2.1 patches should not be run when both the current and the new version numbers are equals
|
||||
else
|
||||
{
|
||||
versionLaterThan =true;
|
||||
}
|
||||
|
||||
return versionLaterThan;
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community</artifactId>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<version>3.1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
0
scripts/cleanImages.sh
Normal file → Executable file
0
scripts/cleanImages.sh
Normal file → Executable file
78
scripts/pushDockerDigestTag.sh
Executable file
78
scripts/pushDockerDigestTag.sh
Executable file
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env bash
|
||||
set -x
|
||||
|
||||
scriptName=`basename "$0"`
|
||||
|
||||
usage="Usage: $scriptName [options]
|
||||
|
||||
-h , --help show this help text
|
||||
-i <sourceImage> a source image to use
|
||||
(e.g. quay.io/alfresco/ags-share-community)
|
||||
-r <repository> a repository to push new tags to
|
||||
(e.g. registry.hub.docker.com)
|
||||
-t <tag> the existing tag for the images (mandatory)
|
||||
-d <digestLength> the length of digest to output (default 12 chars)"
|
||||
|
||||
digestLength=12
|
||||
|
||||
while getopts ':hi:r:t:d:' option; do
|
||||
case "$option" in
|
||||
h) echo -e "Tag one or more images to include the digest and push this to some repositories.\n\n${usage}"
|
||||
exit
|
||||
;;
|
||||
i) sourceImages+=("$OPTARG")
|
||||
;;
|
||||
r) repositories+=("$OPTARG")
|
||||
;;
|
||||
t) existingTag=$OPTARG
|
||||
;;
|
||||
d) digestLength=$OPTARG
|
||||
;;
|
||||
:) echo -e "Missing argument for -${OPTARG}\n\n${usage}" >&2
|
||||
exit 1
|
||||
;;
|
||||
\?) echo -e "Illegal option: -${OPTARG}\n\n${usage}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
if [ "#$existingTag" == "#" ]; then
|
||||
echo -e "Please supply a tag with the -t option.\n\n${usage}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for sourceImage in ${sourceImages[@]}
|
||||
do
|
||||
echo "Processing $sourceImage"
|
||||
|
||||
# Note that this command should work even if the image is already present locally.
|
||||
digest=`docker pull ${sourceImage}:${existingTag} | grep "Digest:" | awk -F':' '{print $3}' | cut -c 1-$digestLength`
|
||||
|
||||
if [ ${#digest} != $digestLength ]
|
||||
then
|
||||
echo "Unexpected length for digest of ${sourceImage}: '${digest}'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
newTag=${existingTag}-${digest}
|
||||
|
||||
# Remove the source repository name if it contains one.
|
||||
slashes=`echo $sourceImage | sed "s|[^/]||g"`
|
||||
if [ ${#slashes} == 2 ]
|
||||
then
|
||||
# The repository name is everything up to the first slash.
|
||||
image=`echo $sourceImage | sed "s|[^/]*/||"`
|
||||
else
|
||||
# Assume the source image doesn't reference the repository name.
|
||||
image=$sourceImage
|
||||
fi
|
||||
|
||||
for repository in ${repositories[@]}
|
||||
do
|
||||
docker tag ${sourceImage}:${existingTag} ${repository}/${image}:${newTag}
|
||||
docker push ${repository}/${image}:${newTag}
|
||||
echo "Pushed ${sourceImage}:${existingTag} to ${repository}/${image}:${newTag}"
|
||||
done
|
||||
done
|
0
scripts/waitForAlfrescoToStart.sh
Normal file → Executable file
0
scripts/waitForAlfrescoToStart.sh
Normal file → Executable file
Reference in New Issue
Block a user