Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -566,13 +566,13 @@ private Group adjustTargetGroup( final RemoteRepository buildRepo, final Group s
"Adding remote repository for Koji build: "
+ buildRepo.getMetadata( NVR ) );

storeDataManager.storeArtifactStore( targetGroup, changeSummary, false, true, new EventMetadata() );
// storeDataManager.storeArtifactStore( targetGroup, changeSummary, false, true, new EventMetadata() );
// Use repo service API to append the member of group instead of to override during target group update.
storeDataManager.addConstituentToGroup( targetGroup.getKey(), buildRepo.getKey() );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have the addConstituentToGroup, is the above storeArtifactStore still needed ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sswguo I just re-read this part, and yes, it seems the original logic is only focused on group update with a new member, so I annotated, and updated 8ad742a

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's what we discussed earlier, to replace that part with the specific endpoint.

}
catch ( IndyDataException e )
catch ( IndyWorkflowException e )
{
wfEx.set( new IndyWorkflowException( "Cannot store target-group: %s changes for: %s. Error: %s", e,
targetGroup.getName(), buildRepo.getMetadata( NVR ),
e.getMessage() ) );
wfEx.set( e );
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.commonjava.indy.data;

import org.commonjava.indy.IndyWorkflowException;
import org.commonjava.indy.audit.ChangeSummary;
import org.commonjava.indy.model.core.ArtifactStore;
import org.commonjava.indy.model.core.Group;
Expand Down Expand Up @@ -177,6 +178,9 @@ Set<Group> affectedBy( Collection<StoreKey> keys )

Set<Group> filterAffectedGroups( Set<Group> affectedGroups );

void addConstituentToGroup( StoreKey key, StoreKey member )
throws IndyWorkflowException;

class ContextualTask
{
private String threadName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.apache.commons.lang3.StringUtils;
import org.commonjava.cdi.util.weft.Locker;
import org.commonjava.cdi.util.weft.NamedThreadFactory;
import org.commonjava.indy.IndyWorkflowException;
import org.commonjava.indy.audit.ChangeSummary;
import org.commonjava.indy.change.event.ArtifactStoreUpdateType;
import org.commonjava.indy.conf.IndyConfiguration;
Expand Down Expand Up @@ -681,4 +682,8 @@ public boolean isExcludedGroup( Group group )
String filter = indyConfiguration.getAffectedGroupsExcludeFilter();
return isNotBlank( filter ) && group.getName().matches( filter );
}

@Override
public abstract void addConstituentToGroup( StoreKey key, StoreKey member )
throws IndyWorkflowException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.commonjava.indy.infinispan.data;

import org.commonjava.indy.IndyWorkflowException;
import org.commonjava.indy.audit.ChangeSummary;
import org.commonjava.indy.conf.IndyConfiguration;
import org.commonjava.indy.data.NoOpStoreEventDispatcher;
Expand Down Expand Up @@ -344,4 +345,10 @@ public void initByPkgMap()
keys.add( store.getKey() );
}
}

@Override
public void addConstituentToGroup( StoreKey key, StoreKey member )
throws IndyWorkflowException
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.commonjava.indy.mem.data;

import org.commonjava.cdi.util.weft.NamedThreadFactory;
import org.commonjava.indy.IndyWorkflowException;
import org.commonjava.indy.audit.ChangeSummary;
import org.commonjava.indy.data.IndyDataException;
import org.commonjava.indy.data.NoOpStoreEventDispatcher;
Expand All @@ -29,7 +30,6 @@
import org.slf4j.LoggerFactory;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Alternative;
import javax.inject.Inject;
import java.util.HashMap;
import java.util.HashSet;
Expand Down Expand Up @@ -180,4 +180,9 @@ protected ArtifactStore putArtifactStoreInternal( StoreKey storeKey, ArtifactSto
return stores.put( storeKey, store );
}

@Override
public void addConstituentToGroup( StoreKey key, StoreKey member )
throws IndyWorkflowException
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.commonjava.indy.db.service;

import org.commonjava.indy.IndyWorkflowException;
import org.commonjava.indy.audit.ChangeSummary;
import org.commonjava.indy.client.core.Indy;
import org.commonjava.indy.client.core.IndyClientException;
Expand Down Expand Up @@ -56,7 +57,6 @@
import static java.util.Collections.emptyMap;
import static java.util.Collections.emptySet;
import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.commonjava.indy.db.common.StoreUpdateAction.STORE;
import static org.commonjava.indy.model.core.ArtifactStore.METADATA_CHANGELOG;
import static org.commonjava.indy.model.core.StoreType.hosted;

Expand Down Expand Up @@ -492,4 +492,18 @@ protected void removeAffectedStore( StoreKey key )
logger.debug( "Do nothing here. Delegate to repository service for further operations." );
}

@Override
public void addConstituentToGroup( StoreKey key, StoreKey member )
throws IndyWorkflowException
{
try
{
client.module( IndyStoresClientModule.class ).addConstituentToGroup( key, member );
}
catch ( IndyClientException e )
{
throw new IndyWorkflowException( "Failed to add member %s into Group %s, Error: %s", e, member, key,
e.getMessage() );
}
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@

<!-- commonjava/redhat projects -->
<indyModelVersion>1.5</indyModelVersion>
<indyClientVersion>3.4.0</indyClientVersion>
<indyClientVersion>3.4.4-SNAPSHOT</indyClientVersion>
<atlasVersion>1.1.4</atlasVersion>
<galleyVersion>1.20</galleyVersion>
<weftVersion>1.24</weftVersion>
Expand Down