Skip to content

Commit

Permalink
Merge branch 'main' into mc/rollout-channel-size-metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
miguel-crespo-fdc authored Jan 28, 2025
2 parents 65cf058 + 8254704 commit c1eaebd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
13 changes: 12 additions & 1 deletion services/cd-service/pkg/repository/transformer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4148,11 +4148,22 @@ func (c *envReleaseTrain) Transform(
return fmt.Sprintf("Environment '%s' is skipped for an unrecognized reason", c.Env)
}
}
allApps, err := state.GetApplications(ctx, transaction)
if err != nil {
return "", err
}
allLatestDeployments, err := state.GetAllLatestDeployments(ctx, transaction, c.Env, allApps)
if err != nil {
return "", err
}

renderApplicationSkipCause := func(SkipCause *api.ReleaseTrainAppPrognosis_SkipCause, appName string) string {
envConfig := c.EnvGroupConfigs[c.Env]
upstreamEnvName := envConfig.Upstream.Environment
currentlyDeployedVersion, _ := state.GetEnvironmentApplicationVersion(ctx, transaction, c.Env, appName)
var currentlyDeployedVersion uint64
if latestDeploymentVersion, found := allLatestDeployments[appName]; found && latestDeploymentVersion != nil {
currentlyDeployedVersion = uint64(*latestDeploymentVersion)
}
teamName, _ := state.GetTeamName(ctx, transaction, appName)
switch SkipCause.SkipCause {
case api.ReleaseTrainAppSkipCause_APP_HAS_NO_VERSION_IN_UPSTREAM_ENV:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe('Release Dialog', () => {
displayVersion: '2',
isMinor: false,
isPrepublish: false,
environments: [],
environments: ['prod'],
},
],
envs: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ export const EnvironmentListItem: React.FC<EnvironmentListItemProps> = ({
}, [app, env.name]);
const deployAndLockClick = useCallback(
(shouldLockToo: boolean) => {
if (!release.environments.includes(env.name)) {
showSnackbarWarn(`Environments skipped: ${env.name}`);
return;
}
if (release.version) {
addAction({
action: {
Expand All @@ -175,7 +179,7 @@ export const EnvironmentListItem: React.FC<EnvironmentListItemProps> = ({
}
}
},
[release.version, app, env.name, createAppLock]
[release.version, release.environments, app, env.name, createAppLock]
);

const queueInfo =
Expand Down Expand Up @@ -226,6 +230,7 @@ export const EnvironmentListItem: React.FC<EnvironmentListItemProps> = ({
}
return otherRelease.version !== release.version;
})();

const releaseDifference = useReleaseDifference(release.version, app, env.name);
const getReleaseDiffContent = (): JSX.Element => {
if (!otherRelease || !deployment) {
Expand Down

0 comments on commit c1eaebd

Please sign in to comment.