Skip to content

Commit fcd096f

Browse files
committed
support auto-update flag in pipelines from config repos
Fix for gocd#11635. Add support for the auto-update flag to be read and used in materials of pipelines that is configured in config repos.
1 parent 077031d commit fcd096f

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

plugin-infra/go-plugin-config-repo/src/main/java/com/thoughtworks/go/plugin/configrepo/contract/material/CRPluggableScmMaterial.java

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ public class CRPluggableScmMaterial extends CRMaterial implements SourceCodeMate
4343
@SerializedName("filter")
4444
@Expose
4545
private CRFilter filter;
46+
@SerializedName("auto_update")
47+
@Expose
48+
private boolean autoUpdate = true;
4649

4750
@SerializedName("plugin_configuration")
4851
@Expose

server/src/main/java/com/thoughtworks/go/config/ConfigConverter.java

+10-6
Original file line numberDiff line numberDiff line change
@@ -395,9 +395,11 @@ private PluggableSCMMaterialConfig toPluggableScmMaterialConfig(CRPluggableScmMa
395395
throw new ConfigConvertionException(
396396
String.format("Failed to find referenced scm '%s'", id));
397397

398-
return new PluggableSCMMaterialConfig(toMaterialName(crPluggableScmMaterial.getName()),
399-
scmConfig, crPluggableScmMaterial.getDestination(),
400-
toFilter(crPluggableScmMaterial.getFilterList()), crPluggableScmMaterial.isWhitelist());
398+
PluggableSCMMaterialConfig materialConfig = new PluggableSCMMaterialConfig(toMaterialName(crPluggableScmMaterial.getName()),
399+
scmConfig, crPluggableScmMaterial.getDestination(),
400+
toFilter(crPluggableScmMaterial.getFilterList()), crPluggableScmMaterial.isWhitelist());
401+
materialConfig.setAutoUpdate(crPluggableScmMaterial.isAutoUpdate());
402+
return materialConfig;
401403
}
402404

403405
private SCMs getSCMs() {
@@ -972,9 +974,11 @@ private CRPluggableScmMaterial pluggableScmMaterialConfigToCRPluggableScmMateria
972974
throw new ConfigConvertionException(
973975
String.format("Failed to find referenced scm '%s'", id));
974976

975-
return new CRPluggableScmMaterial(pluggableScmMaterialConfig.getName().toString(),
976-
id, pluggableScmMaterialConfig.getFolder(),
977-
pluggableScmMaterialConfig.filter().ignoredFileNames(), pluggableScmMaterialConfig.isInvertFilter());
977+
CRPluggableScmMaterial scmMaterial = new CRPluggableScmMaterial(pluggableScmMaterialConfig.getName().toString(),
978+
id, pluggableScmMaterialConfig.getFolder(),
979+
pluggableScmMaterialConfig.filter().ignoredFileNames(), pluggableScmMaterialConfig.isInvertFilter());
980+
scmMaterial.setAutoUpdate(pluggableScmMaterialConfig.isAutoUpdate());
981+
return scmMaterial;
978982
}
979983

980984
private CRPackageMaterial packageMaterialToCRPackageMaterial(PackageMaterialConfig packageMaterialConfig) {

0 commit comments

Comments
 (0)