-
Notifications
You must be signed in to change notification settings - Fork 901
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(artifacts): consolidate artifacts feature flags checks (#8096)
* refactor(artifacts): consolidate artifacts feature flags checks * fix(artifacts): enable artifact-specific stages when only `artifactsRewrite` feature flag is enabled * fix(artifacts): make artifactsMode read-only
- Loading branch information
1 parent
528198a
commit 51dba01
Showing
17 changed files
with
141 additions
and
92 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
app/scripts/modules/core/src/artifact/ArtifactsModeService.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { SETTINGS } from 'core/config'; | ||
|
||
/** | ||
* Currently, because there are two artifacts feature flags, there are four | ||
* possible configuration states: | ||
* 1. `artifacts` disabled, `artifactsRewrite` disabled | ||
* 2. `artifacts` enabled, `artifactsRewrite` disabled | ||
* 3. `artifacts` disabled, `artifactsRewrite` enabled | ||
* 4. `artifacts` enabled, `artifactsRewrite` enabled | ||
* | ||
* However, only three UI experiences should be possible: | ||
* 1. No artifacts UI | ||
* 2. The legacy artifacts UI | ||
* 3. The standard ("rewrite") artifacts UI | ||
* | ||
* This service provides a layer of abstraction over the existing feature flag | ||
* checks in terms of these three possible experiences. As we deprecate these | ||
* feature flags in favor of an enabled-by-default standard artifacts UI, as | ||
* described in https://github.com/spinnaker/governance/pull/111, it will be | ||
* helpful to have this logic isolated to a single service. | ||
*/ | ||
|
||
export enum ArtifactsMode { | ||
DISABLED, | ||
LEGACY, | ||
STANDARD, | ||
} | ||
|
||
export class ArtifactsModeService { | ||
public static readonly artifactsMode = ArtifactsModeService.getArtifactsMode(); | ||
|
||
private static getArtifactsMode(): ArtifactsMode { | ||
if (SETTINGS.feature.artifactsRewrite === true) { | ||
return ArtifactsMode.STANDARD; | ||
} | ||
if (SETTINGS.feature.artifacts === true) { | ||
return ArtifactsMode.LEGACY; | ||
} | ||
return ArtifactsMode.DISABLED; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.