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

Fix code_deploy to properly register S3 rev #732

Merged
merged 2 commits into from
Jan 22, 2018

Conversation

holyjak
Copy link
Contributor

@holyjak holyjak commented Jan 8, 2018

Register a revision based on the latest (presumabely just uploaded)
file (when using S3) so that CodeDeploy will deploy the correct archive.
Otherwise it would deploy the latest registered revision, not the
latest uploaded archive.

As AWS the documentation
says
:

If you've already called the push command to push an application
revision to Amazon S3, you don't need to register the revision.
However, if you upload a revision to Amazon S3 through other means and
want the revision to appear in the AWS CodeDeploy console or through
the AWS CLI, follow these steps to register the revision first.

Notice that we should also do this for GitHub:

If you've pushed an application revision to a GitHub repository and
want the revision to appear in the AWS CodeDeploy console or through
the AWS CLI, you must also follow these steps.

but I do not have the capacity to do that.

Tested both with versioned and non-versioned (no version, still has
etag) buckets.

Copy link
Contributor

@BanzaiMan BanzaiMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the specs, and add build log URL(s) that shows deployment(s) using this code.

Thanks.

@holyjak
Copy link
Contributor Author

holyjak commented Jan 10, 2018

How do I run the specs? I guess I need to start by bundle install but that fails due to ruby/json#229 when installing json-1.8.1. (Ubuntu 16.04, Ruby 2.3.3p222)

Build log: https://travis-ci.com/TeliaSoneraNorge/rapidshop-b2b/builds/63097181

@BanzaiMan
Copy link
Contributor

You can see the failure here: https://travis-ci.org/travis-ci/dpl/jobs/326692313#L1686

@BanzaiMan
Copy link
Contributor

Also, the build you indicated used the release 1.8.43, not your code. Could you review https://github.com/travis-ci/dpl/blob/master/TESTING.md and try again? Thanks.

@holyjak
Copy link
Contributor Author

holyjak commented Jan 10, 2018 via email

@holyjak holyjak force-pushed the master branch 2 times, most recently from c24e64e to 3667bc9 Compare January 11, 2018 10:23
@holyjak
Copy link
Contributor Author

holyjak commented Jan 11, 2018

@holyjak holyjak force-pushed the master branch 3 times, most recently from 9e406e3 to f6fd837 Compare January 11, 2018 12:14
@holyjak
Copy link
Contributor Author

holyjak commented Jan 11, 2018

Here is build log for the latest version: https://travis-ci.com/TeliaSoneraNorge/rapidshop-b2b/builds/63190665

Is there anything else I should fix?

PS: I would still appreciate instructions for how to get bundle and rspec to run locally. (As mentioned above, bundle install fails on json-1.8.1). Ideally a working Vagrantfile for VirtualBox where I could just run gem install bundler; bundle install :)

Copy link
Contributor

@BanzaiMan BanzaiMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Over all it seems good, but I have some stylistic suggestions and one question about unclear piece of data.

@@ -61,6 +76,16 @@ def github_revision
end

def push_app
rev = revision()
if rev[:s3_location]
revInfo = rev[:s3_location]

This comment was marked as spam.

end
code_deploy.register_application_revision({
revision: rev,
application_name: options[:application] || option(:application_name),

This comment was marked as spam.

s3obj = s3api.get_object({
bucket: option(:bucket),
key: s3_key,
range: "bytes=0-1"

This comment was marked as spam.

This comment was marked as spam.

@@ -89,7 +89,9 @@
s3_location: {
bucket: 'bucket',
bundle_type: 'tar',
key: 'key'
key: 'key',
version: 'ObjectVersionId',

This comment was marked as spam.

@holyjak
Copy link
Contributor Author

holyjak commented Jan 16, 2018 via email

@holyjak holyjak force-pushed the master branch 2 times, most recently from 11cebf9 to 7eac080 Compare January 17, 2018 14:16
Register a revision based on the latest (presumabely just uploaded)
file when using S3 or the given commit when using GH
so that CodeDeploy will deploy the correct archive.
Otherwise it would deploy the latest _registered revision_, not the
latest _uploaded archive_.

As [AWS the documentation
says](https://docs.aws.amazon.com/codedeploy/latest/userguide/application-revisions-register.html):

> If you've already called the push command to push an application
> revision to Amazon S3, you don't need to register the revision.
> However, if you upload a revision to Amazon S3 through other means and
> want the revision to appear in the AWS CodeDeploy console or through
> the AWS CLI, follow these steps to register the revision first.
> If you've pushed an application revision to a GitHub repository and
> want the revision to appear in the AWS CodeDeploy console or through
> the AWS CLI, you must also follow these steps.

Tested both with versioned and non-versioned (no version, still has
etag) buckets.
@holyjak
Copy link
Contributor Author

holyjak commented Jan 17, 2018

Here is build log for the latest deployer update: https://travis-ci.com/TeliaSoneraNorge/rapidshop-b2b/builds/63617699

@BanzaiMan
Copy link
Contributor

rake should run specs. However, I suggest using a Docker image or some other means of separation, as it may perform some system-level changes.

@holyjak
Copy link
Contributor Author

holyjak commented Jan 19, 2018 via email

@holyjak
Copy link
Contributor Author

holyjak commented Jan 19, 2018

Can you guys rerun travis? The single version of ruby that failed as an empty log so it is hard to troubleshoot. Perhaps just a temporary hitch?

@holyjak
Copy link
Contributor Author

holyjak commented Jan 22, 2018

@BanzaiMan I think I have addressed all you wanted? Can this be merged now? Thanks!

@BanzaiMan
Copy link
Contributor

Thank you!

@BanzaiMan BanzaiMan merged commit 6c79e0c into travis-ci:master Jan 22, 2018
@holyjak
Copy link
Contributor Author

holyjak commented Jan 22, 2018

Thank you for the help and patience! (Though I would still appreciate also advice on how to bundle install the damn thing ;-))

Any idea when will this be released and availablie at travis-ci? Thanks!

@BanzaiMan
Copy link
Contributor

I'm thinking of (hopefully) the last 1.8.x release tomorrow.

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

Successfully merging this pull request may close these issues.

2 participants