Commit ea45713c authored by Arran Walker's avatar Arran Walker

Update workhorse's zipartifacts to work with Go 1.17

parent ab8d113a
package main package main
import ( import (
"archive/zip"
"context" "context"
"errors" "errors"
"flag" "flag"
...@@ -9,6 +8,7 @@ import ( ...@@ -9,6 +8,7 @@ import (
"io" "io"
"os" "os"
zip "gitlab.com/gitlab-org/golang-archive-zip"
"gitlab.com/gitlab-org/labkit/mask" "gitlab.com/gitlab-org/labkit/mask"
"gitlab.com/gitlab-org/gitlab/workhorse/internal/zipartifacts" "gitlab.com/gitlab-org/gitlab/workhorse/internal/zipartifacts"
......
...@@ -29,6 +29,7 @@ require ( ...@@ -29,6 +29,7 @@ require (
github.com/smartystreets/goconvey v1.6.4 github.com/smartystreets/goconvey v1.6.4
github.com/stretchr/testify v1.7.0 github.com/stretchr/testify v1.7.0
gitlab.com/gitlab-org/gitaly/v14 v14.3.0-rc2.0.20211007055622-df7dadcc3f74 gitlab.com/gitlab-org/gitaly/v14 v14.3.0-rc2.0.20211007055622-df7dadcc3f74
gitlab.com/gitlab-org/golang-archive-zip v0.1.0
gitlab.com/gitlab-org/labkit v1.6.0 gitlab.com/gitlab-org/labkit v1.6.0
gocloud.dev v0.23.0 gocloud.dev v0.23.0
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8 golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8
......
...@@ -835,6 +835,8 @@ gitlab.com/gitlab-org/gitaly/v14 v14.3.0-rc2.0.20211007055622-df7dadcc3f74 h1:7R ...@@ -835,6 +835,8 @@ gitlab.com/gitlab-org/gitaly/v14 v14.3.0-rc2.0.20211007055622-df7dadcc3f74 h1:7R
gitlab.com/gitlab-org/gitaly/v14 v14.3.0-rc2.0.20211007055622-df7dadcc3f74/go.mod h1:2McjFiZrwflPGtXSquCAXWzewmxTPytoI/vamNz/QPM= gitlab.com/gitlab-org/gitaly/v14 v14.3.0-rc2.0.20211007055622-df7dadcc3f74/go.mod h1:2McjFiZrwflPGtXSquCAXWzewmxTPytoI/vamNz/QPM=
gitlab.com/gitlab-org/gitlab-shell v1.9.8-0.20201117050822-3f9890ef73dc/go.mod h1:5QSTbpAHY2v0iIH5uHh2KA9w7sPUqPmnLjDApI/sv1U= gitlab.com/gitlab-org/gitlab-shell v1.9.8-0.20201117050822-3f9890ef73dc/go.mod h1:5QSTbpAHY2v0iIH5uHh2KA9w7sPUqPmnLjDApI/sv1U=
gitlab.com/gitlab-org/gitlab-shell v1.9.8-0.20210720163109-50da611814d2/go.mod h1:QWDYBwuy24qGMandtCngLRPzFgnGPg6LSNoJWPKmJMc= gitlab.com/gitlab-org/gitlab-shell v1.9.8-0.20210720163109-50da611814d2/go.mod h1:QWDYBwuy24qGMandtCngLRPzFgnGPg6LSNoJWPKmJMc=
gitlab.com/gitlab-org/golang-archive-zip v0.1.0 h1:7PoEX9KIr7dBuQDTE+hBQwlOs7PKYsekATrj/i/nR4c=
gitlab.com/gitlab-org/golang-archive-zip v0.1.0/go.mod h1:ZDtqpWPGPB9qBuZnZDrKQjIdJtkN7ZAoVwhT6H2o2kE=
gitlab.com/gitlab-org/labkit v0.0.0-20190221122536-0c3fc7cdd57c/go.mod h1:rYhLgfrbEcyfinG+R3EvKu6bZSsmwQqcXzLfHWSfUKM= gitlab.com/gitlab-org/labkit v0.0.0-20190221122536-0c3fc7cdd57c/go.mod h1:rYhLgfrbEcyfinG+R3EvKu6bZSsmwQqcXzLfHWSfUKM=
gitlab.com/gitlab-org/labkit v0.0.0-20200908084045-45895e129029/go.mod h1:SNfxkfUwVNECgtmluVayv0GWFgEjjBs5AzgsowPQuo0= gitlab.com/gitlab-org/labkit v0.0.0-20200908084045-45895e129029/go.mod h1:SNfxkfUwVNECgtmluVayv0GWFgEjjBs5AzgsowPQuo0=
gitlab.com/gitlab-org/labkit v1.0.0/go.mod h1:nohrYTSLDnZix0ebXZrbZJjymRar8HeV2roWL5/jw2U= gitlab.com/gitlab-org/labkit v1.0.0/go.mod h1:nohrYTSLDnZix0ebXZrbZJjymRar8HeV2roWL5/jw2U=
......
package zipartifacts package zipartifacts
import ( import (
"archive/zip"
"compress/gzip" "compress/gzip"
"encoding/binary" "encoding/binary"
"encoding/json" "encoding/json"
...@@ -9,6 +8,8 @@ import ( ...@@ -9,6 +8,8 @@ import (
"path" "path"
"sort" "sort"
"strconv" "strconv"
zip "gitlab.com/gitlab-org/golang-archive-zip"
) )
type metadata struct { type metadata struct {
......
package zipartifacts_test package zipartifacts_test
import ( import (
"archive/zip"
"bytes" "bytes"
"compress/gzip" "compress/gzip"
"context" "context"
...@@ -12,6 +11,7 @@ import ( ...@@ -12,6 +11,7 @@ import (
"testing" "testing"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
zip "gitlab.com/gitlab-org/golang-archive-zip"
"gitlab.com/gitlab-org/gitlab/workhorse/internal/zipartifacts" "gitlab.com/gitlab-org/gitlab/workhorse/internal/zipartifacts"
) )
......
package zipartifacts package zipartifacts
import ( import (
"archive/zip"
"context" "context"
"fmt" "fmt"
"io" "io"
...@@ -12,6 +11,7 @@ import ( ...@@ -12,6 +11,7 @@ import (
"gitlab.com/gitlab-org/gitlab/workhorse/internal/helper/httptransport" "gitlab.com/gitlab-org/gitlab/workhorse/internal/helper/httptransport"
"gitlab.com/gitlab-org/gitlab/workhorse/internal/httprs" "gitlab.com/gitlab-org/gitlab/workhorse/internal/httprs"
zip "gitlab.com/gitlab-org/golang-archive-zip"
"gitlab.com/gitlab-org/labkit/mask" "gitlab.com/gitlab-org/labkit/mask"
) )
......
package zipartifacts package zipartifacts
import ( import (
"archive/zip"
"bytes" "bytes"
"context" "context"
"fmt" "fmt"
...@@ -10,11 +9,10 @@ import ( ...@@ -10,11 +9,10 @@ import (
"net/http/httptest" "net/http/httptest"
"os" "os"
"path/filepath" "path/filepath"
"runtime"
"strings"
"testing" "testing"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
zip "gitlab.com/gitlab-org/golang-archive-zip"
) )
func createArchive(t *testing.T, dir string) (map[string][]byte, int64) { func createArchive(t *testing.T, dir string) (map[string][]byte, int64) {
...@@ -73,10 +71,6 @@ func TestOpenHTTPArchive(t *testing.T) { ...@@ -73,10 +71,6 @@ func TestOpenHTTPArchive(t *testing.T) {
} }
func TestMinimalRangeRequests(t *testing.T) { func TestMinimalRangeRequests(t *testing.T) {
if strings.HasPrefix(runtime.Version(), "go1.17") {
t.Skipf("skipped for go1.17: https://gitlab.com/gitlab-org/gitlab/-/issues/340778")
}
dir := t.TempDir() dir := t.TempDir()
entries, archiveSize := createArchive(t, dir) entries, archiveSize := createArchive(t, dir)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment