Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ final class BitbucketRepositoryProvider extends RepositoryProvider {

@Override
boolean hasCredentials() {
return config.token
return getToken()
? true
: super.hasCredentials()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ final class GiteaRepositoryProvider extends RepositoryProvider {
return null
}

@Override
boolean hasCredentials() {
return getToken()
? true
: super.hasCredentials()
}

@Override
@CompileDynamic
List<BranchInfo> getBranches() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ class GitlabRepositoryProvider extends RepositoryProvider {
return null
}

@Override
boolean hasCredentials() {
return getToken()
? true
: super.hasCredentials()
}

@Override
String getName() { "GitLab" }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ abstract class RepositoryProvider {

String getPassword() { config?.password }

String getToken() { config?.token }

/**
* @return The name of the source hub service e.g. github or bitbucket
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package nextflow.scm
import spock.lang.IgnoreIf
import spock.lang.Requires
import spock.lang.Specification
import spock.lang.Unroll

/**
*
* @author Akira Sekiguchi <pachiras.yokohama@gmail.com>
Expand Down Expand Up @@ -68,6 +70,22 @@ class GiteaRepositoryProviderTest extends Specification {

}

@Unroll
def 'should validate hasCredentials' () {
given:
def provider = new GiteaRepositoryProvider('pditommaso/tutorial', PROVIDER_CONFIG)

expect:
provider.hasCredentials() == EXPECTED

where:
EXPECTED | PROVIDER_CONFIG
false | new ProviderConfig('gitea')
false | new ProviderConfig('gitea').setUser('foo')
true | new ProviderConfig('gitea').setUser('foo').setPassword('bar')
true | new ProviderConfig('gitea').setToken('xyz')
}

@IgnoreIf({System.getenv('NXF_SMOKE')})
@Requires({System.getenv('NXF_GITEA_ACCESS_TOKEN')})
def 'should read file content'() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package nextflow.scm
import spock.lang.IgnoreIf
import spock.lang.Requires
import spock.lang.Specification
import spock.lang.Unroll

/**
*
Expand All @@ -37,6 +38,22 @@ class GitlabRepositoryProviderTest extends Specification {
new GitlabRepositoryProvider('pditommaso/hello').getRepositoryUrl() == 'https://gitlab.com/pditommaso/hello'
}

@Unroll
def 'should validate hasCredentials' () {
given:
def provider = new GitlabRepositoryProvider('pditommaso/tutorial', CONFIG)

expect:
provider.hasCredentials() == EXPECTED

where:
EXPECTED | CONFIG
false | new ProviderConfig('gitlab')
false | new ProviderConfig('gitlab').setUser('foo')
true | new ProviderConfig('gitlab').setUser('foo').setPassword('bar')
true | new ProviderConfig('gitlab').setToken('xyz')
}

@Requires({System.getenv('NXF_GITLAB_ACCESS_TOKEN')})
def 'should return clone url'() {
given:
Expand Down
Loading