Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try Travis on xenial workers #854

Merged
merged 1 commit into from
Jul 10, 2019
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dist: trusty
dist: xenial
sudo: required

language: go
Expand Down
2 changes: 1 addition & 1 deletion pgp/gnupg.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (g *GpgSigner) gpgArgs() []string {

if g.batch {
args = append(args, "--no-tty", "--batch")
if g.version == GPG21xPlus {
if g.version >= GPG21x {
args = append(args, "--pinentry-mode", "loopback")
}
}
Expand Down
7 changes: 5 additions & 2 deletions pgp/gnupg_finder.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ type GPGVersion int
const (
GPG1x GPGVersion = 1
GPG20x GPGVersion = 2
GPG21xPlus GPGVersion = 3
GPG21x GPGVersion = 3
GPG22xPlus GPGVersion = 4
)

var gpgVersionRegex = regexp.MustCompile(`\(GnuPG\) (\d)\.(\d)`)
Expand Down Expand Up @@ -135,13 +136,15 @@ func cliVersionCheck(cmd string, marker string) (result bool, version GPGVersion
strOutput := string(output)
result = strings.Contains(strOutput, marker)

version = GPG21xPlus
version = GPG22xPlus
matches := gpgVersionRegex.FindStringSubmatch(strOutput)
if matches != nil {
if matches[1] == "1" {
version = GPG1x
} else if matches[1] == "2" && matches[2] == "0" {
version = GPG20x
} else if matches[1] == "2" && matches[2] == "1" {
version = GPG21x
}
}

Expand Down
11 changes: 7 additions & 4 deletions pgp/gnupg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ func (s *Gnupg2SignerSuite) SetUpTest(c *C) {
if err != nil {
c.Skip(err.Error())
}
if ver == GPG21x {
c.Skip("skipping sign test on GnuPG 2.1.x, due to loopback pinentry mode troubles")
}

// import private keys into gpg2, they're stored outside of keyring files
for _, item := range []struct {
Expand All @@ -172,11 +175,11 @@ func (s *Gnupg2SignerSuite) SetUpTest(c *C) {
continue
}

args := []string{"--import", "--no-default-keyring"}
args := []string{"--import", "--no-default-keyring", "--batch"}

if item.suffix == "_passprhase" {
args = append(args, "--passphrase", "verysecret", "--no-tty", "--batch")
if ver == GPG21xPlus {
args = append(args, "--passphrase", "verysecret", "--no-tty")
if ver >= GPG21x {
args = append(args, "--pinentry-mode", "loopback")
}
}
Expand All @@ -190,7 +193,7 @@ func (s *Gnupg2SignerSuite) SetUpTest(c *C) {
// import public keys into gpg2
// we can't use pre-built keyrings as gpg 2.0.x and 2.1+ have different keyring formats
for _, suffix := range []string{"", "_passphrase"} {
output, err := exec.Command(gpg, "--no-default-keyring", "--keyring", "./keyrings/aptly2"+suffix+".gpg",
output, err := exec.Command(gpg, "--no-default-keyring", "--batch", "--keyring", "./keyrings/aptly2"+suffix+".gpg",
"--import", "keyrings/aptly2"+suffix+".pub.armor").CombinedOutput()
c.Log(string(output))
c.Check(err, IsNil)
Expand Down
Loading