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

Deployment doesn't detect new container image build #67

Open
bakerkretzmar opened this issue Apr 21, 2022 · 4 comments
Open

Deployment doesn't detect new container image build #67

bakerkretzmar opened this issue Apr 21, 2022 · 4 comments

Comments

@bakerkretzmar
Copy link
Contributor

I'm running a Sidecar function that uses a container image on ECR, and Sidecar doesn't seem to be able to detect that I've built and pushed up a new version of the container.

php artisan sidecar:deploy --activate tells me Function code and configuration are unchanged. Not updating anything. and then reuses the latest active version of my Lambda instead of creating/aliasing a new one.

The ImageUri hasn't changed because I'm using the latest tag.

Am I missing a step? Should I be tagging the new Docker image build with a date or something, instead of latest, so the Image URI changes?

@bakerkretzmar
Copy link
Contributor Author

Figured out a workaround for now:

    public function package(): array
    {
        return [
            'ImageUri' => config('services.pdf.image_uri'),
+           '__handler__' => substr(md5(file_get_contents(resource_path('lambda/main.py'))), 0, 8),
        ];
    }

Since Sidecar hashes the entire returned package object to determine if the function has changed, just including anything that changes when the underlying Python file changes seems to do the trick here and trigger Sidecar/Lambda to create a new version of the function.

@phuclh
Copy link

phuclh commented Aug 13, 2022

Thank you for the solution. I am using a different tag when pushing to ECR right now but seems your solution is better because I don't need to remember what tags I already used anymore.

@aarondfrancis
Copy link
Owner

Hmm I need to fix this. @bakerkretzmar do you have a general solution that might work here?

@bakerkretzmar
Copy link
Contributor Author

Short answer is no I don't sorry 😅 we eventually switched to using the Node runtime without a Docker image.

It's quite possible that I was using Docker tags wrong and shouldn't have been targeting latest. There's gotta be a way through the AWS API to look up the image the URI points at and see if there's a more recent version of it? Maybe if the URI doesn't have a version tag, you could automatically figure out the last published version? In the docs your example URI is 123456789012.dkr.ecr.us-east-1.amazonaws.com/hello-world:latest, maybe Sidecar could do some extra magic if it sees just 123456789012.dkr.ecr.us-east-1.amazonaws.com/hello-world.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants