Skip to content

Commit

Permalink
fix minio tags (#2173)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgalsaleh committed Sep 18, 2021
1 parent 229d185 commit 6f37ffc
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-test.yaml
Expand Up @@ -260,8 +260,8 @@ jobs:

- name: push minio for e2e
run: |
docker pull minio/minio:${{ steps.dotenv.outputs.minio_tag }}
docker tag minio/minio:${{ steps.dotenv.outputs.minio_tag }} ttl.sh/automated-${{ github.run_id }}/minio:2h
docker pull minio/minio:${{ steps.dotenv.outputs.minio_tag }}
docker tag minio/minio:${{ steps.dotenv.outputs.minio_tag }} ttl.sh/automated-${{ github.run_id }}/minio:2h
docker push ttl.sh/automated-${{ github.run_id }}/minio:2h
Expand Down
2 changes: 1 addition & 1 deletion Makefile
@@ -1,6 +1,6 @@
include Makefile.build
CURRENT_USER := $(shell id -u -n)
MINIO_TAG ?= RELEASE.2021-08-05T22-01-19Z
MINIO_TAG ?= RELEASE.2021-09-15T04-54-25Z
POSTGRES_ALPINE_TAG ?= 10.17-alpine
DEX_TAG ?= v2.28.1
LVP_VERSION := v0.1.0
Expand Down
6 changes: 3 additions & 3 deletions cmd/imagedeps/main.go
Expand Up @@ -97,13 +97,13 @@ func generateTaggedImageFiles(ctx generationContext) error {
return nil
}

type templatePostProcessorFn func(buff []byte)([]byte, error)
type templatePostProcessorFn func(buff []byte) ([]byte, error)

func goFmt(buff []byte)([]byte, error){
func goFmt(buff []byte) ([]byte, error) {
return format.Source(buff)
}

func noopPostProcessor(buff []byte)([]byte, error) {
func noopPostProcessor(buff []byte) ([]byte, error) {
return buff, nil
}

Expand Down
35 changes: 17 additions & 18 deletions pkg/image/image_test.go
Expand Up @@ -545,49 +545,48 @@ func Test_stripImageTag(t *testing.T) {
}

func TestGetTag(t *testing.T) {
tt := []struct{
name string
imageRef string
tt := []struct {
name string
imageRef string
expectedTag string
wantErr bool
wantErr bool
}{
{
name:"happy path",
imageRef: "some/image:v1.2.3",
name: "happy path",
imageRef: "some/image:v1.2.3",
expectedTag: "v1.2.3",
},
{
name: "failed case",
name: "failed case",
imageRef: "",
wantErr: true,
wantErr: true,
},
{
name: "no tag",
name: "no tag",
imageRef: "foo/bar",
wantErr: true,
wantErr: true,
},
{
name: "fat fingered",
name: "fat fingered",
imageRef: "some/image:",
wantErr: true,
wantErr: true,
},
{
name: "long image",
imageRef: "some/image/image2:v1.2.3",
name: "long image",
imageRef: "some/image/image2:v1.2.3",
expectedTag: "v1.2.3",

},
}

for _, tc := range tt {
t.Run(tc.name, func(t *testing.T){
t.Run(tc.name, func(t *testing.T) {
actual, err := GetTag(tc.imageRef)
if tc.wantErr {
require.NotNil(t, err)
return
}
require.Nil(t, err)
require.Equal(t, tc.expectedTag, actual )
require.Equal(t, tc.expectedTag, actual)
})
}
}
}
2 changes: 1 addition & 1 deletion pkg/kotsadm/objects/images.go
Expand Up @@ -14,7 +14,7 @@ func GetAdminConsoleImage(deployOptions types.DeployOptions, imageKey string) st

func GetAdminConsoleImages(deployOptions types.DeployOptions) map[string]string {
// TODO: Add error handling to this function
minioTag, _ := image.GetTag(image.Minio)
minioTag, _ := image.GetTag(image.Minio)
postgresTag := getPostgresTag(deployOptions)
dexTag, _ := image.GetTag(image.Dex)

Expand Down
2 changes: 1 addition & 1 deletion pkg/kotsadm/objects/postgres_objects.go
Expand Up @@ -254,7 +254,7 @@ func getPostgresTag(deployOptions types.DeployOptions) string {
// TODO: This breaks when the hidden kotsadm-tag CLI flag is used to push images. There will be only one postgres image.
// TODO: Add error handling getPostgres tag should return error
alpineTag, _ := image.GetTag(image.PostgresAlpine)
debianTag, _ := image.GetTag(image.PostgresDebian) // use this when version cannot be determined because this tag always works
debianTag, _ := image.GetTag(image.PostgresDebian) // use this when version cannot be determined because this tag always works

if !deployOptions.IsOpenShift {
return alpineTag
Expand Down
7 changes: 6 additions & 1 deletion pkg/snapshot/filesystem.go
Expand Up @@ -13,6 +13,7 @@ import (

"github.com/google/uuid"
"github.com/pkg/errors"
"github.com/replicatedhq/kots/pkg/image"
"github.com/replicatedhq/kots/pkg/k8sutil"
kotsadmresources "github.com/replicatedhq/kots/pkg/kotsadm/resources"
kotsadmtypes "github.com/replicatedhq/kots/pkg/kotsadm/types"
Expand Down Expand Up @@ -267,7 +268,11 @@ func ensureFileSystemMinioDeployment(ctx context.Context, clientset kubernetes.I
}

func fileSystemMinioDeploymentResource(clientset kubernetes.Interface, secretChecksum string, deployOptions FileSystemDeployOptions, registryOptions kotsadmtypes.KotsadmOptions) (*appsv1.Deployment, error) {
image := "minio/minio:RELEASE.2021-08-05T22-01-19Z"
minioTag, err := image.GetTag(image.Minio)
if err != nil {
return nil, errors.Wrap(err, "failed to get minio image tag")
}
image := fmt.Sprintf("minio/minio:%s", minioTag)
imagePullSecrets := []corev1.LocalObjectReference{}

if !kotsutil.IsKurl(clientset) || deployOptions.Namespace != metav1.NamespaceDefault {
Expand Down

0 comments on commit 6f37ffc

Please sign in to comment.