Reputation: 31
I am using wercker. I am trying to push the container for GCR in th internal/docker-push. But error message is displayd as belog:
Error interacting with this repository: gcr.io/my-gcr-project/wercker PUT https://gcr.io/v1/repositories/my-gcr-project/wercker/ returned 401
My wercker.yml is
steps:
- internal/docker-push:
username: _json_key
password: $GCR_JSON_KEY_FILE
registry: https://gcr.io
repository: gcr.io/my-gcr-project/my-image-name
tag: test
AND $GCR_JSON_KEY_FILE is Wercker Environment variables
It sets as follows : (Values were masked.)
GCR_JSON_KEY_FILE:
{
"type": "",
"project_id": "",
"private_key_id": "",
"private_key": "",
"client_email": "",
"client_id": "",
"auth_uri": "",
"token_uri": "",
"auth_provider_x509_cert_url": "",
"client_x509_cert_url": ""
}
What should I do?
Upvotes: 3
Views: 398
Reputation: 341
After downloading the JSON key file from the Google Cloud Console, open it and delete the whitespaces. Leave it a single-line JSON. If you paste it as it is in the Wercker GUI, you'll have it polluted with '\n' and authentication with GCR will fail.
Upvotes: 11
Reputation: 346
Can you check that your YAML file is correctly formatted?
It looks like you're setting "internal/docker-push" to null, which is probably not what you want.
Try this:
steps:
- internal/docker-push:
username: _json_key
password: $GCR_JSON_KEY_FILE
registry: https://gcr.io
repository: gcr.io/my-gcr-project/my-image-name
tag: test
Upvotes: 1
Reputation: 1707
Can you reach out to us on gcr-contact at google.com (only GCR folks can see this list) and provide slightly more information? Just masking the private_key
should be sufficient.
As a sanity check, does the project_id
in your JSON key match my-gcr-project
, which I believe (from your error) is aagcp-1205
?
Upvotes: 0