This repository was archived by the owner on Mar 14, 2023. It is now read-only.
Commit 4ae0f89 1 parent 1d995dc commit 4ae0f89 Copy full SHA for 4ae0f89
File tree 2 files changed +29
-10
lines changed
packages/shipit-deploy/src/tasks/deploy
2 files changed +29
-10
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ const fetchTask = shipit => {
22
22
shipit . log ( 'Create workspace...' )
23
23
/* eslint-disable no-param-reassign */
24
24
if ( shipit . config . shallowClone ) {
25
- const tmpDir = await tmp . dir ( { mode : " 0755" } )
25
+ const tmpDir = await tmp . dir ( { mode : ' 0755' } )
26
26
shipit . workspace = tmpDir . path
27
27
} else {
28
28
shipit . workspace = shipit . config . workspace
@@ -174,14 +174,20 @@ const fetchTask = shipit => {
174
174
}
175
175
176
176
await createWorkspace ( )
177
- await initRepository ( )
178
- await setGitConfig ( )
179
- await addRemote ( )
180
- await fetch ( )
181
- await checkout ( )
182
- await reset ( )
183
- await merge ( )
184
- await updateSubmodules ( )
177
+
178
+ if ( shipit . config . repositoryUrl ) {
179
+ await initRepository ( )
180
+ await setGitConfig ( )
181
+ await addRemote ( )
182
+ await fetch ( )
183
+ await checkout ( )
184
+ await reset ( )
185
+ await merge ( )
186
+ await updateSubmodules ( )
187
+ } else {
188
+ shipit . log ( chalk . yellow ( 'Skip fetching repo. No repositoryUrl provided' ) )
189
+ }
190
+
185
191
shipit . emit ( 'fetched' )
186
192
} )
187
193
}
Original file line number Diff line number Diff line change @@ -6,11 +6,13 @@ jest.mock('tmp-promise')
6
6
7
7
describe ( 'deploy:fetch task' , ( ) => {
8
8
let shipit
9
+ let log
9
10
10
11
beforeEach ( ( ) => {
12
+ log = jest . fn ( )
11
13
shipit = new Shipit ( {
12
14
environment : 'test' ,
13
- log : jest . fn ( ) ,
15
+ log,
14
16
} )
15
17
16
18
fetchTask ( shipit )
@@ -129,4 +131,15 @@ describe('deploy:fetch task', () => {
129
131
expect ( shipit . local ) . toBeCalledWith ( 'git checkout master' , opts )
130
132
expect ( shipit . local ) . toBeCalledWith ( 'git branch --list master' , opts )
131
133
} )
134
+
135
+ it ( 'should skip fetching if no repositoryUrl provided' , async ( ) => {
136
+ delete shipit . config . repositoryUrl
137
+
138
+ await start ( shipit , 'deploy:fetch' )
139
+
140
+ expect ( shipit . local ) . not . toHaveBeenCalled ( )
141
+ expect ( log ) . toBeCalledWith (
142
+ expect . stringContaining ( 'Skip fetching repo. No repositoryUrl provided' ) ,
143
+ )
144
+ } )
132
145
} )
You can’t perform that action at this time.
0 commit comments