Skip to content

OMMX Artifact Push Failed to Google Cloud Artifact Registry #606

@j-i-k-o

Description

@j-i-k-o

Background

While considering the operational use of OMMX artifacts with Google Cloud Artifact Registry, it was discovered that the current OMMX implementation has compatibility issues.

I confirmed that pushing images to Artifact Registry works when using docker push with the same credentials, indicating that this is not a permissions or authentication issue of Google Cloud.

Steps to Reproduce

We assume the following Artifact Registry and image/tag name:

  • Location: asia-northeast1-docker.pkg.dev
  • Google Cloud Project: test-project
  • Artifact Registry Repository: test-repo
  • Image and Tag Name: test-image:tag1
  1. Set up environment variables following the official Google Cloud Artifact Registry documentation via access token authentication:

    • OMMX_BASIC_AUTH_USERNAME = oauth2accesstoken
    • OMMX_BASIC_AUTH_PASSWORD = [obtained access token]
    • OMMX_BASIC_AUTH_DOMAIN = asia-northeast1.docker.pkg.dev
  2. Execute OMMX artifact push operation:

    from ommx.artifact import Artifact, ArtifactBuilder
    
    builder = ArtifactBuilder.new("asia-northeast1-docker.pkg.dev/test-project/test-repo/test-image:tag1")
    
    # add ommx.v1.Instance object `instance`
    desc_instance = builder.add_instance(instance)
    
    artifact = builder.build()
    artifact.push()

Expected Behavior

  • OMMX artifact should be successfully pushed to Google Cloud Artifact Registry
  • Should work with OCI-compliant container registries other than GitHub Container Registry

Actual Behavior

The following error occurs and push fails:

Traceback (most recent call last):
  File "/Users/jiko/workspace/python/ommx_instance_upload/script.py", line 17, in <module>
    artifact.push()
  File "/Users/jiko/workspace/python/ommx_instance_upload/.venv/lib/python3.11/site-packages/ommx/artifact.py", line 158, in push
    self._base.push()
  File "/Users/jiko/workspace/python/ommx_instance_upload/.venv/lib/python3.11/site-packages/ommx/artifact.py", line 100, in push
    self._base.push()
RuntimeError: Failed to read JSON: expected value at line 1 column 1

Stack Backtrace (RUST_BACKTRACE=1)

Stack backtrace:
   0: std::backtrace::Backtrace::create
   1: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
   2: <ocipkg::distribution::auth::AuthChallenge as core::convert::TryFrom<ureq::error::Error>>::try_from
   3: ocipkg::distribution::client::Client::call
   4: ocipkg::distribution::client::Client::push_blob
   5: <ocipkg::image::remote::RemoteBuilder as ocipkg::image::layout::ImageBuilder>::add_blob
   6: ommx::artifact::Artifact<ocipkg::image::oci_dir::OciDir>::push
   7: _ommx_rust::artifact::ArtifactDir::__pymethod_push__
   8: pyo3::impl_::trampoline::trampoline
   9: _ommx_rust::artifact::<impl pyo3::impl_::pyclass::PyMethods<_ommx_rust::artifact::ArtifactDir> for pyo3::impl_::pyclass::PyClassImplCollector<_ommx_rust::artifact::ArtifactDir>>::py_methods::ITEMS::trampoline
  10: _method_vectorcall_NOARGS
  11: _PyObject_Vectorcall
  12: __PyEval_EvalFrameDefault
  13: _PyEval_EvalCode
  14: _run_mod
  15: __PyRun_SimpleFileObject
  16: __PyRun_AnyFileObject
  17: _Py_RunMain
  18: _pymain_main
  19: _Py_BytesMain

Additional Information

  • Push to GitHub Packages has been confirmed to work properly
  • Using docker push command with the same credentials successfully pushes to Artifact Registry
  • The error occurs during JSON reading process, suggesting an issue with authentication response handling

Related Links

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions