[#466] adm: Allow to download contracts from Gitea
All checks were successful
DCO action / DCO (pull_request) Successful in 2m25s
Vulncheck / Vulncheck (pull_request) Successful in 1m58s
Tests and linters / Staticcheck (pull_request) Successful in 5m31s
Tests and linters / Tests (1.21) (pull_request) Successful in 5m53s
Tests and linters / Tests (1.20) (pull_request) Successful in 6m6s
Tests and linters / Lint (pull_request) Successful in 6m22s
Tests and linters / Tests with -race (pull_request) Successful in 6m41s
Build / Build Components (1.21) (pull_request) Successful in 1m40s
Build / Build Components (1.20) (pull_request) Successful in 1m56s

Signed-off-by: Olga Konstantinova <kola43843@gmail.com>
This commit is contained in:
Olga Konstantinova 2024-02-03 20:17:12 +03:00 committed by okonstantinova
parent 805862f4b7
commit 80b581d499
6 changed files with 129 additions and 7 deletions

View file

@ -399,10 +399,14 @@ func (c *initializeContext) readContracts(names []string) error {
}
} else {
var r io.ReadCloser
if c.ContractPath == "" {
return errors.New("contracts flag is missing")
if c.ContractPath != "" {
r, err = os.Open(c.ContractPath)
} else if c.ContractURL != "" {
r, err = downloadContracts(c.Command, c.ContractURL)
} else {
r, err = downloadContractsFromRepository(c.Command)
}
r, err = os.Open(c.ContractPath)
if err != nil {
return fmt.Errorf("can't open contracts archive: %w", err)
}