1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
import { DOCS_URL_IN_EE_DIR } from 'jh_else_ce/lib/utils/url_utility';
export const mockFilteredRefs = {
Branches: ['branch-1'],
Tags: ['1.0.0', '1.1.0'],
};
export const mockQueryParams = {
refParam: 'tag-1',
variableParams: {
test_var: 'test_var_val',
},
fileParams: {
test_file: 'test_file_val',
},
};
export const mockProjectId = '21';
export const mockPostParams = {
ref: 'tag-1',
variables_attributes: [
{ key: 'test_var', secret_value: 'test_var_val', variable_type: 'env_var' },
{ key: 'test_file', secret_value: 'test_file_val', variable_type: 'file' },
],
};
export const mockError = {
errors: [
'test job: chosen stage does not exist; available stages are .pre, build, test, deploy, .post',
],
warnings: [
`jobs:build1 may allow multiple pipelines to run for a single action due to \`rules:when\` clause with no \`workflow:rules\` - read more: ${DOCS_URL_IN_EE_DIR}/ci/troubleshooting.html#pipeline-warnings`,
`jobs:build2 may allow multiple pipelines to run for a single action due to \`rules:when\` clause with no \`workflow:rules\` - read more: ${DOCS_URL_IN_EE_DIR}/ci/troubleshooting.html#pipeline-warnings`,
`jobs:build3 may allow multiple pipelines to run for a single action due to \`rules:when\` clause with no \`workflow:rules\` - read more: ${DOCS_URL_IN_EE_DIR}/ci/troubleshooting.html#pipeline-warnings`,
],
total_warnings: 7,
};
export const mockCreditCardValidationRequiredError = {
errors: ['Credit card required to be on file in order to create a pipeline'],
warnings: [],
total_warnings: 0,
};
export const mockBranchRefs = ['main', 'dev', 'release'];
export const mockTagRefs = ['1.0.0', '1.1.0', '1.2.0'];
export const mockVariables = [
{
uniqueId: 'var-refs/heads/main2',
variable_type: 'env_var',
key: 'var_without_value',
value: '',
},
{
uniqueId: 'var-refs/heads/main3',
variable_type: 'env_var',
key: 'var_with_value',
value: 'test_value',
},
{ uniqueId: 'var-refs/heads/main4', variable_type: 'env_var', key: '', value: '' },
];
export const mockYamlVariables = [
{
description: 'This is a variable with a value.',
key: 'VAR_WITH_VALUE',
value: 'test_value',
valueOptions: null,
},
{
description: 'This is a variable with a multi-line value.',
key: 'VAR_WITH_MULTILINE',
value: `this is
a multiline value`,
valueOptions: null,
},
{
description: 'This is a variable with predefined values.',
key: 'VAR_WITH_OPTIONS',
value: 'staging',
valueOptions: ['development', 'staging', 'production'],
},
];
export const mockYamlVariablesWithoutDesc = [
{
description: 'This is a variable with a value.',
key: 'VAR_WITH_VALUE',
value: 'test_value',
valueOptions: null,
},
{
description: null,
key: 'VAR_WITH_MULTILINE',
value: `this is
a multiline value`,
valueOptions: null,
},
{
description: null,
key: 'VAR_WITH_OPTIONS',
value: 'staging',
valueOptions: ['development', 'staging', 'production'],
},
];
export const mockCiConfigVariablesQueryResponse = (ciConfigVariables) => ({
data: {
project: {
id: 1,
ciConfigVariables,
},
},
});
export const mockCiConfigVariablesResponse = mockCiConfigVariablesQueryResponse(mockYamlVariables);
export const mockEmptyCiConfigVariablesResponse = mockCiConfigVariablesQueryResponse([]);
export const mockCiConfigVariablesResponseWithoutDesc = mockCiConfigVariablesQueryResponse(
mockYamlVariablesWithoutDesc,
);
export const mockNoCachedCiConfigVariablesResponse = mockCiConfigVariablesQueryResponse(null);
export const mockPipelineConfigButtonText = 'Go to the pipeline editor';
|