Skip to content

Commit cbfa232

Browse files
swingingsimianNathan Johnsonpditommaso
authored
Update Gitea provider to gitea.com as default server (#6285) [ci fast]
Signed-off-by: Nathan Johnson <[email protected]> Signed-off-by: Paolo Di Tommaso <[email protected]> Co-authored-by: Nathan Johnson <[email protected]> Co-authored-by: Paolo Di Tommaso <[email protected]>
1 parent 12fbef3 commit cbfa232

File tree

3 files changed

+17
-20
lines changed

3 files changed

+17
-20
lines changed

modules/nextflow/src/main/groovy/nextflow/scm/ProviderConfig.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class ProviderConfig {
7777

7878
case 'gitea':
7979
attr.platform = name
80-
if( !attr.server ) attr.server = 'https://try.gitea.io'
80+
if( !attr.server ) attr.server = 'https://gitea.com' // default to free tier
8181
if( !attr.endpoint ) attr.endpoint = attr.server.toString().stripEnd('/') + '/api/v1'
8282
break
8383

modules/nextflow/src/test/groovy/nextflow/scm/GiteaRepositoryProviderTest.groovy

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,38 +27,25 @@ import spock.lang.Unroll
2727
*/
2828
class GiteaRepositoryProviderTest extends Specification {
2929

30-
static final String CONFIG = '''
31-
providers {
32-
mygitea {
33-
server = 'https://gitea.com'
34-
endpoint = 'https://gitea.com/api/v1'
35-
platform = 'gitea'
36-
}
37-
}
38-
'''
39-
4030
def 'should return repo url' () {
4131
given:
42-
def config = new ConfigSlurper().parse(CONFIG)
43-
def obj = new ProviderConfig('gitea', config.providers.mygitea as ConfigObject)
32+
def obj = new ProviderConfig('gitea')
4433

4534
expect:
4635
new GiteaRepositoryProvider('pditommaso/hello', obj).getEndpointUrl() == 'https://gitea.com/api/v1/repos/pditommaso/hello'
4736
}
4837

4938
def 'should return project URL' () {
5039
given:
51-
def config = new ConfigSlurper().parse(CONFIG)
52-
def obj = new ProviderConfig('gitea', config.providers.mygitea as ConfigObject)
40+
def obj = new ProviderConfig('gitea')
5341

5442
expect:
5543
new GiteaRepositoryProvider('pditommaso/hello', obj).getRepositoryUrl() == 'https://gitea.com/pditommaso/hello'
5644
}
5745

5846
def 'should return content URL' () {
5947
given:
60-
def config = new ConfigSlurper().parse(CONFIG)
61-
def obj = new ProviderConfig('gitea', config.providers.mygitea as ConfigObject)
48+
def obj = new ProviderConfig('gitea')
6249

6350
expect:
6451
new GiteaRepositoryProvider('pditommaso/hello', obj)
@@ -91,7 +78,7 @@ class GiteaRepositoryProviderTest extends Specification {
9178
def 'should read file content'() {
9279
given:
9380
def token = System.getenv('NXF_GITEA_ACCESS_TOKEN')
94-
def config = new ProviderConfig('gitea', new ConfigSlurper().parse(CONFIG).providers.mygitea as ConfigObject) .setAuth(token)
81+
def config = new ProviderConfig('gitea') .setAuth(token)
9582

9683
when:
9784
def repo = new GiteaRepositoryProvider('pditommaso/test-hello', config)
@@ -112,7 +99,7 @@ class GiteaRepositoryProviderTest extends Specification {
11299
def 'should read bytes gitea content'() {
113100
given:
114101
def token = System.getenv('NXF_GITEA_ACCESS_TOKEN')
115-
def config = new ProviderConfig('gitea', new ConfigSlurper().parse(CONFIG).providers.mygitea as ConfigObject) .setAuth(token)
102+
def config = new ProviderConfig('gitea') .setAuth(token)
116103
def repo = new GiteaRepositoryProvider('pditommaso/test-hello', config)
117104
and:
118105
def DATA = this.class.getResourceAsStream('/test-asset.bin').bytes
@@ -129,7 +116,7 @@ class GiteaRepositoryProviderTest extends Specification {
129116
def 'should read bytes file content'() {
130117
given:
131118
def token = System.getenv('NXF_GITEA_ACCESS_TOKEN')
132-
def config = new ProviderConfig('gitea', new ConfigSlurper().parse(CONFIG).providers.mygitea as ConfigObject).setAuth(token)
119+
def config = new ProviderConfig('gitea').setAuth(token)
133120

134121
when:
135122
def repo = new GiteaRepositoryProvider('pditommaso/test-hello', config)

modules/nextflow/src/test/groovy/nextflow/scm/ProviderConfigTest.groovy

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,16 @@ class ProviderConfigTest extends Specification {
189189
config.user == null
190190
config.password == null
191191
config.token == 'xyz'
192+
193+
when:
194+
config = new ProviderConfig('gitea', [auth: 'xyz'])
195+
then:
196+
config.auth == null
197+
config.user == null
198+
config.password == null
199+
config.token == 'xyz'
200+
config.server == 'https://gitea.com'
201+
config.endpoint == 'https://gitea.com/api/v1'
192202
}
193203

194204
def 'should ending slash and add protocol prefix' () {

0 commit comments

Comments
 (0)