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

Ambiguous JSON object required for ecr put-image #8620

Open
AndrewCharlesHay opened this issue Apr 4, 2024 · 5 comments
Open

Ambiguous JSON object required for ecr put-image #8620

AndrewCharlesHay opened this issue Apr 4, 2024 · 5 comments
Assignees
Labels
bug This issue is a bug. documentation This is a problem with documentation. ecr p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@AndrewCharlesHay
Copy link

AndrewCharlesHay commented Apr 4, 2024

Describe the issue

I'm trying to pass the following JSON object in the --image-manifest argument to tag a helm chart but I keep getting the following error:

An error occurred (InvalidParameterException) when calling the PutImage operation: Invalid parameter at 'ImageManifest' failed to satisfy constraint: 'Invalid JSON syntax'

The documentation gives an example of a JSON object related to Docker that mine JSON closely resembles but there is never any definition of what is required. I just have to guess and hope that it matches the expectations.

{
  "schemaVersion": 2,
  "config": {
    "mediaType": "application/vnd.cncf.helm.config.v1+json",
    "digest": "sha256:34cd28a1b9b3237128a0dd0f7c03edc36c112887b4e491ea6f3d6fe469ac4a86",
    "size": 151
  },
  "layers": [
    {
      "mediaType": "application/vnd.cncf.helm.chart.content.v1.tar+gzip",
      "digest": "sha256:777d773fa08d8a7b256dc78d9ee5dfa96b2fc8dee66d531f831bd7ef098b2dc2",
      "size": 4513
    }
  ],
  "annotations": {
    "org.opencontainers.image.created": "2024-04-04T14:44:40Z",
    "org.opencontainers.image.description": "BMS | Worflow Platform Service",
    "org.opencontainers.image.title": "svc-bms-wkfptf",
    "org.opencontainers.image.version": "1.6.0"
  },
  "mediaType": "application/vnd.cncf.helm.config.v1+json"
}

Links

https://docs.aws.amazon.com/cli/latest/reference/ecr/put-image.html

@AndrewCharlesHay AndrewCharlesHay added documentation This is a problem with documentation. needs-triage This issue or PR still needs to be triaged. labels Apr 4, 2024
@RyanFitzSimmonsAK RyanFitzSimmonsAK self-assigned this Apr 9, 2024
@RyanFitzSimmonsAK RyanFitzSimmonsAK added bug This issue is a bug. investigating This issue is being investigated and/or work is in progress to resolve the issue. ecr p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Apr 9, 2024
@RyanFitzSimmonsAK
Copy link
Contributor

Hi @AndrewCharlesHay, thanks for reaching out. I did some testing, and it seems that the issue is related to mediaType. If I change "mediaType": "application/vnd.cncf.helm.config.v1+json" to match the example you referenced, the JSON is accepted as valid. We have a few related issues (aws/aws-sdk#193, boto/boto3#3295), and they were able to bypass this issue using ImageManifestMediaType, rather than having it inside the manifest. In my testing, that workaround did not work for me. Assuming it doesn't work for you either, I can reach out to the service team for more information about the intended syntax for Helm charts here.

@RyanFitzSimmonsAK RyanFitzSimmonsAK added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Apr 30, 2024
Copy link

Greetings! It looks like this issue hasn’t been active in longer than five days. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels May 10, 2024
@AndrewCharlesHay
Copy link
Author

AndrewCharlesHay commented Jun 10, 2024

Hi @RyanFitzSimmonsAK

Sorry for the late response. My issue is that it's not an image though it's a Helm Chart so the ImageManifestMediaType isn't applicable. If you could reach out to the team that would be great!

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jun 10, 2024
@haofeif
Copy link

haofeif commented Jun 22, 2024

Hi I have the same issue. In my case i want to apply the "latest" tag to my HELM chart on ECR

aws ecr put-image --repository-name XXXXXX --image-tag latest --image-manifest "$MANIFEST"

An error occurred (InvalidParameterException) when calling the PutImage operation: Invalid parameter at 'ImageManifest' failed to satisfy constraint: 'Invalid JSON syntax'

and my imageManifest was getting from

MANIFEST=$(aws ecr batch-get-image --repository-name XXXXX --image-ids imageTag="version-number" --output text --query 'images[].imageManifest')

the output of my MANIFEST is as below :

{
    "schemaVersion":2,
    "config":{
        "mediaType":"application/vnd.cncf.helm.config.v1+json",
        "digest":"sha256:91df0fe079fe78dasfdsafsadfsadfasdfafdasdfasf",
        "size":126
    },
    "layers":[{
        "mediaType":"application/vnd.cncf.helm.chart.content.v1.tar+gzip",
        "digest":"sha256:a3ead2ddsadfasdfsafaefsfdsfafafsafasasf",
        "size":11223
    }]
 }

thanks for your help and please keep this response open until you find the root cause. Same here it is for a HELM chart not a docker image

@RyanFitzSimmonsAK
Copy link
Contributor

Hey, before I reach out to the service team, could you take a look at https://docs.aws.amazon.com/AmazonECR/latest/userguide/push-oci-artifact.html, and let me know if this process works for you?

@RyanFitzSimmonsAK RyanFitzSimmonsAK added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. documentation This is a problem with documentation. ecr p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

3 participants