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

InvalidParameterException: An error occurred (InvalidParameterException) when calling the DescribeImages operation: Invalid parameter at 'imageTag' failed to satisfy constraint: 'must satisfy regular expression '[a-zA-Z0-9-_.]+ #99

Closed
srossross opened this issue Nov 27, 2017 · 9 comments

Comments

@srossross
Copy link

@srossross srossross commented Nov 27, 2017

I'm new to forge and trying it out for the first time. I'm getting this error when running forge deploy:

forge --version
forge 0.3.17
forge deploy --dry-run
║ 15 tasks run, 1 errors
║   None: unexpected error
║     
║     Traceback (most recent call last):
║       File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/cli.py", line 330, in root
║         service.go(name)
║       File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/cli.py", line 323, in service
║         goal(svc)
║       File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/cli.py", line 494, in <lambda>
║         forge.execute(lambda svc: forge.deploy(*forge.build(svc)))
║       File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/cli.py", line 259, in build
║         self.bake(service)
║       File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/cli.py", line 218, in bake
║         raw = list(cull(lambda c: not self.docker.exists(c.image, c.version), service.containers))
║       File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/tasks.py", line 321, in cull
║         execs.append((task.go(obj), obj))
║       File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/tasks.py", line 304, in applicator
║         return obj(*args, **kwargs)
║       File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/cli.py", line 218, in <lambda>
║         raw = list(cull(lambda c: not self.docker.exists(c.image, c.version), service.containers))
║       File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/docker.py", line 39, in exists
║         return self.remote_exists(name, version) or self.local_exists(name, version)
║       File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/docker.py", line 291, in remote_exists
║         imageIds=[{'imageTag': version}])
║       File "/Users/srossross/.pex/install/botocore-1.7.36-py2.py3-none-any.whl.e62f85f5a0ca8aa5a8463cb3a05c85cd337b6ff6/botocore-1.7.36-py2.py3-none-any.whl/botocore/client.py", line 312, in _api_call
║         return self._make_api_call(operation_name, kwargs)
║       File "/Users/srossross/.pex/install/botocore-1.7.36-py2.py3-none-any.whl.e62f85f5a0ca8aa5a8463cb3a05c85cd337b6ff6/botocore-1.7.36-py2.py3-none-any.whl/botocore/client.py", line 605, in _make_api_call
║         raise error_class(parsed_response, operation_name)
║     InvalidParameterException: An error occurred (InvalidParameterException) when calling the DescribeImages operation: Invalid parameter at 'imageTag' failed to satisfy constraint: 'must satisfy regular expression '[a-zA-Z0-9-_.]+''

git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)
@rhs
Copy link
Contributor

@rhs rhs commented Nov 27, 2017

Thanks for taking the time to report this. Is there any way you could run the command again with the --verbose flag, e.g. forge --verbose deploy --dry-run?

@srossross
Copy link
Author

@srossross srossross commented Nov 27, 2017

I tried to ssh into my machine which produced the error, but I am getting this new error. I will report again when I get back to my machine:

forge --verbose deploy --dry-run
Traceback (most recent call last):
  File "/usr/local/bin/forge/.bootstrap/_pex/pex.py", line 365, in execute
  File "/usr/local/bin/forge/.bootstrap/_pex/pex.py", line 293, in _wrap_coverage
  File "/usr/local/bin/forge/.bootstrap/_pex/pex.py", line 325, in _wrap_profiling
  File "/usr/local/bin/forge/.bootstrap/_pex/pex.py", line 408, in _execute
  File "/usr/local/bin/forge/.bootstrap/_pex/pex.py", line 466, in execute_entry
  File "/usr/local/bin/forge/.bootstrap/_pex/pex.py", line 484, in execute_pkg_resources
  File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/cli.py", line 515, in call_main
    exit(forge())
  File "/Users/srossross/.pex/install/click-6.7-py2.py3-none-any.whl.6d9ff910081ac14222b6215822bc2664662de745/click-6.7-py2.py3-none-any.whl/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Users/srossross/.pex/install/click-6.7-py2.py3-none-any.whl.6d9ff910081ac14222b6215822bc2664662de745/click-6.7-py2.py3-none-any.whl/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Users/srossross/.pex/install/click-6.7-py2.py3-none-any.whl.6d9ff910081ac14222b6215822bc2664662de745/click-6.7-py2.py3-none-any.whl/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/srossross/.pex/install/click-6.7-py2.py3-none-any.whl.6d9ff910081ac14222b6215822bc2664662de745/click-6.7-py2.py3-none-any.whl/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/srossross/.pex/install/click-6.7-py2.py3-none-any.whl.6d9ff910081ac14222b6215822bc2664662de745/click-6.7-py2.py3-none-any.whl/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Users/srossross/.pex/install/click-6.7-py2.py3-none-any.whl.6d9ff910081ac14222b6215822bc2664662de745/click-6.7-py2.py3-none-any.whl/click/decorators.py", line 27, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/cli.py", line 494, in deploy
    forge.execute(lambda svc: forge.deploy(*forge.build(svc)))
  File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/cli.py", line 332, in execute
    exe = root.run()
  File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/tasks.py", line 253, in run
    result.executor.echo(result.report())
  File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/executor.py", line 378, in echo
    print msg
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2551' in position 5: ordinal not in range(128)

@srossross
Copy link
Author

@srossross srossross commented Nov 27, 2017

Here is the error with the --verbose flag

) forge --verbose deploy --dry-run 
║ CONFIG: /workspaces/tableau/project1/forge.yaml
║ git rev-parse --abbrev-ref HEAD
║ master
║ git diff --quiet HEAD .
║ git log -n1 --format=oneline -- .
║ 638d5c2ed0f2dbaea55e4e0d3852ea47592a2873 adding forge
║ 15 tasks run, 1 errors
║   None: unexpected error
║     
║     Traceback (most recent call last):
║       File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/cli.py", line 330, in root
║         service.go(name)
║       File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/cli.py", line 323, in service
║         goal(svc)
║       File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/cli.py", line 494, in <lambda>
║         forge.execute(lambda svc: forge.deploy(*forge.build(svc)))
║       File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/cli.py", line 259, in build
║         self.bake(service)
║       File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/cli.py", line 218, in bake
║         raw = list(cull(lambda c: not self.docker.exists(c.image, c.version), service.containers))
║       File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/tasks.py", line 321, in cull
║         execs.append((task.go(obj), obj))
║       File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/tasks.py", line 304, in applicator
║         return obj(*args, **kwargs)
║       File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/cli.py", line 218, in <lambda>
║         raw = list(cull(lambda c: not self.docker.exists(c.image, c.version), service.containers))
║       File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/docker.py", line 39, in exists
║         return self.remote_exists(name, version) or self.local_exists(name, version)
║       File "/Users/srossross/.pex/install/Forge-0.3.17-py2-none-any.whl.0fdff23604e35d291a0fb190a10d5cd1f9a15845/Forge-0.3.17-py2-none-any.whl/forge/docker.py", line 291, in remote_exists
║         imageIds=[{'imageTag': version}])
║       File "/Users/srossross/.pex/install/botocore-1.7.36-py2.py3-none-any.whl.e62f85f5a0ca8aa5a8463cb3a05c85cd337b6ff6/botocore-1.7.36-py2.py3-none-any.whl/botocore/client.py", line 312, in _api_call
║         return self._make_api_call(operation_name, kwargs)
║       File "/Users/srossross/.pex/install/botocore-1.7.36-py2.py3-none-any.whl.e62f85f5a0ca8aa5a8463cb3a05c85cd337b6ff6/botocore-1.7.36-py2.py3-none-any.whl/botocore/client.py", line 605, in _make_api_call
║         raise error_class(parsed_response, operation_name)
║     InvalidParameterException: An error occurred (InvalidParameterException) when calling the DescribeImages operation: Invalid parameter at 'imageTag' failed to satisfy constraint: 'must satisfy regular expression '[a-zA-Z0-9-_.]+''
@rhs
Copy link
Contributor

@rhs rhs commented Nov 28, 2017

Thanks for the quick reply. Is there any way you could report the output of forge build metadata?

@srossross
Copy link
Author

@srossross srossross commented Nov 28, 2017

env: {GOPATH: /workspaces/personal/go, TERM_PROGRAM_VERSION: 388.1.1, AWS_PROFILE: srossross-mfa,
  LOGNAME: srossross, USER: srossross, PROMPT_COMMAND: exitstatus; update_terminal_cwd,
  HOME: /Users/srossross, PATH: '/usr/local/sbin:/Library/Application Support/teradata/client/15.10/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/opt/local/bin:/workspaces/personal/go/bin',
  TERM_PROGRAM: Apple_Terminal, LANG: en_US.UTF-8, __CF_USER_TEXT_ENCODING: '0x2D4A0905:0x0:0x0',
  TERM: xterm-256color, SHELL: /bin/bash, SHLVL: '1',  XPC_FLAGS: '0x0', HISTSIZE: '5000', _: /usr/local/bin/forge, HISTFILESIZE: '5000',
  P4EDITOR: vim, TERM_SESSION_ID: 1D1ABCBF-XXX-2A43A65CC9F0, XPC_SERVICE_NAME: '0',
  PYTHONPATH: ':/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages',
  SSH_AUTH_SOCK: /private/tmp/com.apple.launchd.XXX/Listeners, Apple_PubSub_Socket_Render: /private/tmp/com.apple.launchd.XXX/Render,
  P4CONFIG: .p4config, USER_BACKEND: XYZ, TMPDIR: /var/folders/5n/XYZ/T/,
  HISTCONTROL: 'ignoreboth:erasedups', PWD: /workspaces/project1}
service:
  name: hello-world
  profiles:
    default: {endpoint: /hello/, max_memory: 0.5G, max_cpu: 0.5}
    canary: {endpoint: /hello/, weight: 10.0, max_memory: 0.5G, max_cpu: 0.5}
  containers: [Dockerfile]
build:
  branch: master
  version: f57bb031c7d6cd9b36aaeca6595378ce6d58bd22.sha
  profile: {endpoint: /hello/, max_memory: 0.5G, max_cpu: 0.5, name: default}
  name: hello-world-default
  images: {Dockerfile: 'XYZ.dkr.ecr.us-west-2.amazonaws.com/hello-world:f57bb031c7d6cd9b36aaeca6595378ce6d58bd22.sha',
    workgroup/project1/docker-containers/frontend-container/Dockerfile: 'XYZ.dkr.ecr.us-west-2.amazonaws.com/hello-world-workgroup-project1-docker-containers-frontend-container:f57bb031c7d6cd9b36aaeca6595378ce6d58bd22.sha'}

@srossross
Copy link
Author

@srossross srossross commented Nov 28, 2017

I thought maybe it was the git log -n1 --format=oneline -- . that was causing this error, so to work around it I made a change to my repo to dirty the git commit.

git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
  (use "git push" to publish your local commits)
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   .gitlab-ci.yml

Running on OSX using minikube, I get this error:

forge --verbose deploy --dry-run 
║ CONFIG: /workspaces/tableau/project1/forge.yaml
║ git rev-parse --abbrev-ref HEAD
║ master
║ git diff --quiet HEAD .

║ docker images -q XYZ.dkr.ecr.us-west-2.amazonaws.com/hello-world:f57bb031c7d6cd9b36aaeca6595378ce6d58bd22.sha
║ Cannot connect to the Docker daemon at tcp://192.168.99.101:2376. Is the docker daemon running?
║ 17 tasks run, 1 errors
║   hello-world: command 'docker images -q XYZ.dkr.ecr.us-west-2.amazonaws.com/hello-world:f57bb031c7d6cd9b36aaeca6595378ce6d58bd22.sha' failed[1]: Cannot connect to the Docker daemon at tcp://192.168.99.101:2376. Is the docker daemon running?

Running eval $(minikube docker-env) fixes this issue, but I'm not sure why this would need to run the build with the minikube docker rather than my local docker.

In fact, we are running kubernetes 1.7.5 which (in minikube at least) does not support docker versions with multi stage builds.

@rhs
Copy link
Contributor

@rhs rhs commented Nov 28, 2017

In that last case forge is just invoking the docker images command to figure out if it needs to rebuild the image, so if the connect is failing it is likely because docker is somehow misconfigured. You can try running docker images yourself just as a sanity check.

Regarding the InvalidParameterException, I'm a bit confused. This is an error message that is coming from the ECR API, and the version we are passing should be the very same f57bb031c7d6cd9b36aaeca6595378ce6d58bd22.sha reported as the build version in the metadata output you supplied. AFAICT, that version doesn't violate the regex that is supplied with the error message.

I've added some extra logging to the code that invokes the ECR API just as a sanity check. If you can update to forge 0.3.18 and rerun with the --verbose flag again, we should be able to see exactly what is being passed into the ECR API, and hopefully that will get to the bottom of this.

@srossross
Copy link
Author

@srossross srossross commented Nov 28, 2017

It looks like you need to add the --no-color option to git log. For now I can disable color in my git settings.

║ 638d5c2ed0f2dbaea55e4e0d3852ea47592a2873 adding forge
║ checking for remote version: '\x1b[33m638d5c2ed0f2dbaea55e4e0d3852ea47592a2873\x1b[m.git'
...
║     ClientError: An error occurred (ExpiredTokenException) when calling the DescribeImages operation: The security token included in the request is expired

@rhs
Copy link
Contributor

@rhs rhs commented Nov 28, 2017

Thanks a lot for helping track this down. I just released a fix for this in 0.3.19. Please reopen if you run into anymore problems with this.

@rhs rhs closed this Nov 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.