Я пытаюсь использовать переменные внутри команды curl, и я получаю одно из следующих двух:
test.sh строка 32: неожиданный EOF при поиске соответствия `"'
test.sh строка 33: синтаксическая ошибка: неожиданный конец файла
"$key"
Моя команда:
curl 'http://1.1.1.1:8080/v2-beta/projects/1a25/stack' -H 'content-type: application/json' -data-binary $'{"system":true,"type":"stack","name":"ecr","startOnCreate":true,"environment":{"key_id":"$key","access_key":"214356","aws_region":"ap-southeast-2","auto_create":"false","log_level":"INFO","registry_in_which_environment":"current","environment_api_endpoint":"12345.dkr.amazonaws.com","environment_api_access_key":"7AC2D3FE5A1C12345","environment_api_secret_key":"QMmwp7ebmzK1ZcUCjoRM12345"},"dockerCompose":"ecr-updater:\\n environment:\\n AWS_ACCESS_KEY_ID: ${aws_access_key_id}\\n AWS_SECRET_ACCESS_KEY: ${aws_secret_access_key}\\n AWS_REGION: ${aws_region}\\n AUTO_CREATE: ${auto_create}\\n LOG_LEVEL: ${log_level}\\n {{- if eq .Values.registry_in_which_environment \\"other\\" }}\\n CATTLE_URL: ${environment_api_endpoint}\\n CATTLE_ACCESS_KEY: ${environment_api_access_key}\\n CATTLE_SECRET_KEY: ${environment_api_secret_key}\\n {{- end }}\\n labels:\\n io.rancher.container.pull_image: always\\n {{- if eq .Values.registry_in_which_environment \\"current\\" }}\\n io.rancher.container.create_agent: \'true\'\\n io.rancher.container.agent.role: environment\\n {{- end }}\\n tty: true\\n image: rancher/rancher-ecr-credentials:v2.0.1\\n stdin_open: true\\n","rancherCompose":".catalog:\\n name: \\"ECR Credential Updater\\"\\n version: \\"v2.0.1\\"\\n description: \\"Updates credentials for ECR in Rancher\\"\\n minimum_rancher_version: \\"v1.6.13-rc1\\"\\n questions:\\n - variable: \\"aws_access_key_id\\"\\n label: \\"AWS Access Key ID\\"\\n description: \\"AWS API Access Key to use for obtaining ECR credentials. Not required if using IAM roles.\\"\\n required: false\\n type: \\"string\\"\\n - variable: \\"aws_secret_access_key\\"\\n label: \\"AWS Secret Access Key\\"\\n description: \\"AWS API Secret Key to use for obtaining ECR credentials. Not required if using IAM roles.\\"\\n required: false\\n type: \\"string\\"\\n - variable: \\"aws_region\\"\\n label: \\"AWS Region\\"\\n description: \\"AWS Region that hosts the ECR\\"\\n default: us-east-1\\n required: true\\n type: \\"string\\"\\n - variable: \\"auto_create\\"\\n label: \\"Auto Create\\"\\n description: \\"Automatically create registry in Rancher for corresponding ECR repo if it doesn\'t already exist\\"\\n default: \\"false\\"\\n required: true\\n type: \\"string\\"\\n - variable: \\"log_level\\"\\n label: \\"Log Level\\"\\n description: \\"Logging level to run service at\\"\\n default: \\"INFO\\"\\n required: true\\n type: \\"string\\"\\n - variable: \\"registry_in_which_environment\\"\\n type: enum\\n label: \\"Registry Environment\\"\\n description: \\"Which environment is the AWS registry located?\\"\\n default: current\\n options:\\n - current\\n - other\\n - variable: \\"environment_api_endpoint\\"\\n label: \\"URL (Environment API Endpoint) of Registry to be Updated\\"\\n description: \\"URL for where the registry is located. This is the endpoint, which can be found under the Advanced Options under API -> Keys, for an Environment API Key.\\"\\n default: \\"\\"\\n required: false\\n type: \\"string\\"\\n - variable: \\"environment_api_access_key\\"\\n label: \\"Access Key of an Environment API Key\\"\\n description: \\"This access key must be for the environment where the registry will need to be updated. This access key will be created in the same environment listed for the URL. This can be created in the Advanced Options under API.\\"\\n default: \\"\\"\\n required: false\\n type: \\"string\\"\\n - variable: \\"environment_api_secret_key\\"\\n label: \\"Secret Key of an Environment API Key\\"\\n description: \\"This secret key must be for the environment where the registry will need to be updated. This secret key will be created in the same environment listed for the URL. This can be created in the Advanced Options under API.\\"\\n default: \\"\\"\\n required: false\\n type: \\"string\\"\\necr-updater:\\n scale: 1\\n","externalId":"catalog://library:infra*ecr:1"}'