From de4b153daa22536dde60971771836bd2a8b8d979 Mon Sep 17 00:00:00 2001 From: Manan Bhatt Date: Wed, 29 Oct 2025 19:28:20 +0530 Subject: [PATCH 1/3] trust docker inspect exit code for runtime label detection --- airflow/docker_image.go | 4 ++-- cloud/deploy/deploy.go | 2 +- software/deploy/deploy.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/airflow/docker_image.go b/airflow/docker_image.go index e971f989c..3804a4e8b 100644 --- a/airflow/docker_image.go +++ b/airflow/docker_image.go @@ -518,8 +518,8 @@ func (d *DockerImage) GetLabel(altImageName, labelName string) (string, error) { if err != nil { return label, err } - if execErr := stderr.String(); execErr != "" { - return label, fmt.Errorf("%s: %w", execErr, errGetImageLabel) + if execWarn := strings.TrimSpace(stderr.String()); execWarn != "" { + logger.Debugf("container runtime stderr while inspecting %s: %s", imageName, execWarn) } label = stdout.String() label = strings.Trim(label, "\n") diff --git a/cloud/deploy/deploy.go b/cloud/deploy/deploy.go index 6ee0d94dc..bf9a047b9 100644 --- a/cloud/deploy/deploy.go +++ b/cloud/deploy/deploy.go @@ -40,7 +40,7 @@ const ( composeSkipImageBuildingPromptMsg = "Skipping building image..." deploymentHeaderMsg = "Authenticated to %s \n\n" - warningInvalidImageNameMsg = "WARNING! The image in your Dockerfile '%s' is not based on Astro Runtime and is not supported. Change your Dockerfile with an image that pulls from 'quay.io/astronomer/astro-runtime' to proceed.\n" + warningInvalidImageNameMsg = "WARNING! The image in your Dockerfile '%s' is not based on Astro Runtime and is not supported. Use an Astronomer Runtime image such as 'quay.io/astronomer/astro-runtime' or 'astrocrpublic.azurecr.io/astronomer/astro-runtime' to proceed.\n" allTests = "all-tests" parseAndPytest = "parse-and-all-tests" diff --git a/software/deploy/deploy.go b/software/deploy/deploy.go index 1cc067f37..9588e59ad 100644 --- a/software/deploy/deploy.go +++ b/software/deploy/deploy.go @@ -47,7 +47,7 @@ var ( ErrEmptyDagFolderUserCancelledOperation = errors.New("no DAGs found in the dags folder. User canceled the operation") ErrBYORegistryDomainNotSet = errors.New("Custom registry host is not set in config. It can be set at astronomer.houston.config.deployments.registry.protectedCustomRegistry.updateRegistry.host") //nolint ErrDeploymentTypeIncorrectForImageOnly = errors.New("--image only works for Dag-only, Git-sync-based and NFS-based deployments") - WarningInvalidImageNameMsg = "WARNING! The image in your Dockerfile '%s' is not based on Astro Runtime and is not supported. Change your Dockerfile with an image that pulls from 'quay.io/astronomer/astro-runtime' to proceed.\n" + WarningInvalidImageNameMsg = "WARNING! The image in your Dockerfile '%s' is not based on Astro Runtime and is not supported. Use an Astronomer Runtime image such as 'quay.io/astronomer/astro-runtime' or 'astrocrpublic.azurecr.io/astronomer/astro-runtime' to proceed.\n" ErrNoRuntimeLabelOnCustomImage = errors.New("the image should have label io.astronomer.docker.runtime.version") ErrRuntimeVersionNotPassedForRemoteImage = errors.New("if --image-name and --remote is passed, it's mandatory to pass --runtime-version") ) From 046419db8c97f0ec1a7d301304af000d6cb09146 Mon Sep 17 00:00:00 2001 From: Manan Bhatt Date: Wed, 29 Oct 2025 19:41:20 +0530 Subject: [PATCH 2/3] updated registries --- cloud/deploy/deploy.go | 2 +- software/deploy/deploy.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cloud/deploy/deploy.go b/cloud/deploy/deploy.go index bf9a047b9..ab2ec96c7 100644 --- a/cloud/deploy/deploy.go +++ b/cloud/deploy/deploy.go @@ -40,7 +40,7 @@ const ( composeSkipImageBuildingPromptMsg = "Skipping building image..." deploymentHeaderMsg = "Authenticated to %s \n\n" - warningInvalidImageNameMsg = "WARNING! The image in your Dockerfile '%s' is not based on Astro Runtime and is not supported. Use an Astronomer Runtime image such as 'quay.io/astronomer/astro-runtime' or 'astrocrpublic.azurecr.io/astronomer/astro-runtime' to proceed.\n" + warningInvalidImageNameMsg = "WARNING! The image in your Dockerfile '%s' is not based on Astro Runtime and is not supported. Use an Astronomer Runtime image such as 'quay.io/astronomer/astro-runtime', 'astrocrpublic.azurecr.io/astronomer/astro-runtime', or 'astrocrpublic.azurecr.io/runtime' (for Runtime 3.x) to proceed.\n" allTests = "all-tests" parseAndPytest = "parse-and-all-tests" diff --git a/software/deploy/deploy.go b/software/deploy/deploy.go index 9588e59ad..77848f42e 100644 --- a/software/deploy/deploy.go +++ b/software/deploy/deploy.go @@ -47,7 +47,7 @@ var ( ErrEmptyDagFolderUserCancelledOperation = errors.New("no DAGs found in the dags folder. User canceled the operation") ErrBYORegistryDomainNotSet = errors.New("Custom registry host is not set in config. It can be set at astronomer.houston.config.deployments.registry.protectedCustomRegistry.updateRegistry.host") //nolint ErrDeploymentTypeIncorrectForImageOnly = errors.New("--image only works for Dag-only, Git-sync-based and NFS-based deployments") - WarningInvalidImageNameMsg = "WARNING! The image in your Dockerfile '%s' is not based on Astro Runtime and is not supported. Use an Astronomer Runtime image such as 'quay.io/astronomer/astro-runtime' or 'astrocrpublic.azurecr.io/astronomer/astro-runtime' to proceed.\n" + WarningInvalidImageNameMsg = "WARNING! The image in your Dockerfile '%s' is not based on Astro Runtime and is not supported. Use an Astronomer Runtime image such as 'quay.io/astronomer/astro-runtime', 'astrocrpublic.azurecr.io/astronomer/astro-runtime', or 'astrocrpublic.azurecr.io/runtime' (for Runtime 3.x) to proceed.\n" ErrNoRuntimeLabelOnCustomImage = errors.New("the image should have label io.astronomer.docker.runtime.version") ErrRuntimeVersionNotPassedForRemoteImage = errors.New("if --image-name and --remote is passed, it's mandatory to pass --runtime-version") ) From 16f28b6df64fc2723b2e9c692eba72ebe6e8a819 Mon Sep 17 00:00:00 2001 From: Manan Bhatt Date: Sat, 1 Nov 2025 14:43:45 +0530 Subject: [PATCH 3/3] updated the test case --- airflow/docker_image_test.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/airflow/docker_image_test.go b/airflow/docker_image_test.go index c799306b1..0058a4bbc 100644 --- a/airflow/docker_image_test.go +++ b/airflow/docker_image_test.go @@ -544,17 +544,20 @@ func (s *Suite) TestDockerImageGetLabel() { s.ErrorIs(err, errMockDocker) }) - s.Run("cmdExec failure", func() { + s.Run("cmdExec stderr warning", func() { mockLabel := "test-label" + mockStdout := "label-value" mockErrResp := "test-err-response" cmdExec = func(cmd string, stdout, stderr io.Writer, args ...string) error { s.Contains(args[2], mockLabel) + io.WriteString(stdout, mockStdout) io.WriteString(stderr, mockErrResp) return nil } - _, err := handler.GetLabel("", mockLabel) - s.ErrorIs(err, errGetImageLabel) + resp, err := handler.GetLabel("", mockLabel) + s.NoError(err) + s.Equal(mockStdout, resp) }) }