From 6f3bd83ad4e11edd0302a92c09a102ff41e070e7 Mon Sep 17 00:00:00 2001 From: lydiafilipe Date: Sat, 12 Mar 2022 04:21:25 +0000 Subject: [PATCH 1/5] file changes for merge with agent AL1 --- .github/ISSUE_TEMPLATE.md | 39 -- .github/PULL_REQUEST_TEMPLATE.md | 40 -- .gitignore | 21 - CODE_OF_CONDUCT.md | 4 - CONTRIBUTING.md | 70 --- CHANGELOG.md => INIT_CHANGELOG.md | 0 README.md => INIT_README.md | 0 NOTICE | 2 - THIRD-PARTY | 932 ------------------------------ Makefile => init_Makefile | 0 scripts/analyze-cover-profile | 27 - 11 files changed, 1135 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE.md delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .gitignore delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md rename CHANGELOG.md => INIT_CHANGELOG.md (100%) rename README.md => INIT_README.md (100%) delete mode 100644 NOTICE delete mode 100644 THIRD-PARTY rename Makefile => init_Makefile (100%) delete mode 100755 scripts/analyze-cover-profile diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index 14a45eb0bf1..00000000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,39 +0,0 @@ - - -### Summary - - -### Description - - -### Expected Behavior - - -### Observed Behavior - - -### Environment Details - - -### Supporting Log Snippets - diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3e5099002b0..00000000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,40 +0,0 @@ - - -### Summary - - - -### Implementation details - - - -### Testing - - -New tests cover the changes: - -### Description for the changelog - - - -### Licensing - -This contribution is under the terms of the Apache 2.0 License: diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 00ed47d8cf9..00000000000 --- a/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -/amazon-ecs-init* -/BUILDROOT/ -/x86_64/ -/sources.tar -/ecs-init-* -*.swp -/ecs.conf -/.rpm-done -/.srpm-done -/BUILD -/RPMS -/SOURCES -/SRPMS -/ecs-init.spec -/sources.tgz -ecs-agent-*.tar -ecs.service -*.log -.idea/ -cover.out -coverprofile.out diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index 3b64466870c..00000000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,4 +0,0 @@ -## Code of Conduct -This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). -For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact -opensource-codeofconduct@amazon.com with any additional questions or comments. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 6fa337317eb..00000000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,70 +0,0 @@ -# Contributing to Amazon ECS Init - -Contributions to Amazon ECS Init should be made via GitHub [pull -requests](https://github.com/aws/amazon-ecs-init/pulls) and discussed using -GitHub [issues](https://github.com/aws/amazon-ecs-init/issues). - -### Before you start - -If you would like to make a significant change, it's a good idea to first open -an issue to discuss it. - -### Making the request - -Development takes place against the `dev` branch of this repository and pull -requests should be opened against that branch. - -Non-code changes, such as updating the README, may be against master if they are -applicable to master. - -### Testing - -Any contributions should pass all tests. - -You may run all test by either running the `make test` target (requires `go` -and `go cover` to be installed) or by running the `make test-in-docker` target -which requires only Docker to be installed. - -### Packaging - -Amazon ECS Init is officially supported when packaged as an RPM for -the Amazon Linux AMI. We welcome other packaging contributions in the -`packaging` folder. - -The RPM packaging includes `Provides` declarations for bundled sources -(vendored golang libraries) that should be maintained and kept up to -date as dependencies are added and removed. - -## Licensing - -Amazon ECS Init is released under an [Apache -2.0](http://aws.amazon.com/apache-2-0/) license. Any code you submit will be -released under that license. - -For significant changes, we may ask you to sign a [Contributor License -Agreement](http://en.wikipedia.org/wiki/Contributor_License_Agreement). - -## Amazon Open Source Code of Conduct - -This code of conduct provides guidance on participation in Amazon-managed open source communities, and outlines the process for reporting unacceptable behavior. As an organization and community, we are committed to providing an inclusive environment for everyone. Anyone violating this code of conduct may be removed and banned from the community. - -**Our open source communities endeavor to:** -* Use welcoming and inclusive language; -* Be respectful of differing viewpoints at all times; -* Accept constructive criticism and work together toward decisions; -* Focus on what is best for the community and users. - -**Our Responsibility.** As contributors, members, or bystanders we each individually have the responsibility to behave professionally and respectfully at all times. Disrespectful and unacceptable behaviors include, but are not limited to: -The use of violent threats, abusive, discriminatory, or derogatory language; -* Offensive comments related to gender, gender identity and expression, sexual orientation, disability, mental illness, race, political or religious affiliation; -* Posting of sexually explicit or violent content; -* The use of sexualized language and unwelcome sexual attention or advances; -* Public or private [harassment](http://todogroup.org/opencodeofconduct/#definitions) of any kind; -* Publishing private information, such as physical or electronic address, without permission; -* Other conduct which could reasonably be considered inappropriate in a professional setting; -* Advocating for or encouraging any of the above behaviors. - -**Enforcement and Reporting Code of Conduct Issues.** -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting opensource-codeofconduct@amazon.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. - -**Attribution.** _This code of conduct is based on the [template](http://todogroup.org/opencodeofconduct) established by the [TODO Group](http://todogroup.org/) and the Scope section from the [Contributor Covenant version 1.4](http://contributor-covenant.org/version/1/4/)._ diff --git a/CHANGELOG.md b/INIT_CHANGELOG.md similarity index 100% rename from CHANGELOG.md rename to INIT_CHANGELOG.md diff --git a/README.md b/INIT_README.md similarity index 100% rename from README.md rename to INIT_README.md diff --git a/NOTICE b/NOTICE deleted file mode 100644 index cb8f830cb5c..00000000000 --- a/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -Amazon Elastic Container Service RPM -Copyright 2014-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/THIRD-PARTY b/THIRD-PARTY deleted file mode 100644 index 5ce32509fe2..00000000000 --- a/THIRD-PARTY +++ /dev/null @@ -1,932 +0,0 @@ -** aws-sdk-go; version 1.13.24 -- https://github.com/aws/aws-sdk-go -AWS SDK for Go -Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. -Copyright 2014-2015 Stripe, Inc. -** docker/docker; version 1.12.0-rc4 -- https://github.com/docker/docker -Docker -Copyright 2012-2015 Docker, Inc. - -This product includes software developed at Docker, Inc. -(https://www.docker.com). - -This product contains software (https://github.com/kr/pty) developed -by Keith Rarick, licensed under the MIT License. - -The following is courtesy of our legal counsel: - - -Use and transfer of Docker may be subject to certain restrictions by the -United States and other governments. -It is your responsibility to ensure that your use and/or transfer does not -violate applicable laws. - -For more information, please see https://www.bis.doc.gov - -See also https://www.apache.org/dev/crypto.html and/or seek legal counsel. -** github.com/coreos/go-systemd; version v22.0.0 -- -https://github.com/coreos/go-systemd -CoreOS Project -Copyright 2018 CoreOS, Inc - -This product includes software developed at CoreOS, Inc. -(http://www.coreos.com/). -** github.com/docker/go-connections; version -e15c02316c12de00874640cd76311849de2aeed5 -- -https://github.com/docker/go-connections -Apache License - Version 2.0, January 2004 - https://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - Copyright 2015 Docker, Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -** github.com/docker/go-plugins-helpers/; version -1e6269c305b8c75cfda1c8aa91349c38d7335814 -- -https://github.com/docker/go-plugins-helpers/ -Docker -Copyright 2012-2015 Docker, Inc. - -This product includes software developed at Docker, Inc. -(https://www.docker.com). - -This product contains software (https://github.com/kr/pty) developed -by Keith Rarick, licensed under the MIT License. - -The following is courtesy of our legal counsel: - - -Use and transfer of Docker may be subject to certain restrictions by the -United States and other governments. -It is your responsibility to ensure that your use and/or transfer does not -violate applicable laws. - -For more information, please see https://www.bis.doc.gov - -See also https://www.apache.org/dev/crypto.html and/or seek legal counsel. -** github.com/golang/mock; version bd3c8e81be01eef76d4b503f5e687d2d1354d2d9 -- -https://github.com/golang/mock/blob/master/LICENSE -Alex Reece -Google Inc. -** github.com/opencontainers/go-digest; version v1.0.0-rc1 -- -https://github.com/opencontainers/go-digest -Copyright © 2016 Docker, Inc. -** github.com/opencontainers/image-spec; version v1.0.1 -- -https://github.com/opencontainers/image-spec -Copyright 2016 The Linux Foundation. -** github.com/opencontainers/runc; version v0.1.1 -- -https://github.com/opencontainers/runc -Copyright 2014 Docker, Inc. -** go-ini/ini; version v1.21.1 -- https://github.com/go-ini/ini -Copyright 2016 -** jmespath/go-jmespath; version 0.2.2 -- -https://github.com/jmespath/go-jmespath -Copyright 2015 James Saryerwinnie - -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND -DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, and - distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by the - copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all other - entities that control, are controlled by, or are under common control - with that entity. For the purposes of this definition, "control" means - (i) the power, direct or indirect, to cause the direction or management - of such entity, whether by contract or otherwise, or (ii) ownership of - fifty percent (50%) or more of the outstanding shares, or (iii) - beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity exercising - permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation source, - and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but not limited - to compiled object code, generated documentation, and conversions to - other media types. - - "Work" shall mean the work of authorship, whether in Source or Object - form, made available under the License, as indicated by a copyright - notice that is included in or attached to the work (an example is - provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object form, - that is based on (or derived from) the Work and for which the editorial - revisions, annotations, elaborations, or other modifications represent, - as a whole, an original work of authorship. For the purposes of this - License, Derivative Works shall not include works that remain separable - from, or merely link (or bind by name) to the interfaces of, the Work and - Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including the original - version of the Work and any modifications or additions to that Work or - Derivative Works thereof, that is intentionally submitted to Licensor for - inclusion in the Work by the copyright owner or by an individual or Legal - Entity authorized to submit on behalf of the copyright owner. For the - purposes of this definition, "submitted" means any form of electronic, - verbal, or written communication sent to the Licensor or its - representatives, including but not limited to communication on electronic - mailing lists, source code control systems, and issue tracking systems - that are managed by, or on behalf of, the Licensor for the purpose of - discussing and improving the Work, but excluding communication that is - conspicuously marked or otherwise designated in writing by the copyright - owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity on - behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of this - License, each Contributor hereby grants to You a perpetual, worldwide, - non-exclusive, no-charge, royalty-free, irrevocable copyright license to - reproduce, prepare Derivative Works of, publicly display, publicly perform, - sublicense, and distribute the Work and such Derivative Works in Source or - Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of this - License, each Contributor hereby grants to You a perpetual, worldwide, - non-exclusive, no-charge, royalty-free, irrevocable (except as stated in - this section) patent license to make, have made, use, offer to sell, sell, - import, and otherwise transfer the Work, where such license applies only to - those patent claims licensable by such Contributor that are necessarily - infringed by their Contribution(s) alone or by combination of their - Contribution(s) with the Work to which such Contribution(s) was submitted. - If You institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work or a - Contribution incorporated within the Work constitutes direct or contributory - patent infringement, then any patent licenses granted to You under this - License for that Work shall terminate as of the date such litigation is - filed. - - 4. Redistribution. You may reproduce and distribute copies of the Work or - Derivative Works thereof in any medium, with or without modifications, and - in Source or Object form, provided that You meet the following conditions: - - (a) You must give any other recipients of the Work or Derivative Works a - copy of this License; and - - (b) You must cause any modified files to carry prominent notices stating - that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works that You - distribute, all copyright, patent, trademark, and attribution notices - from the Source form of the Work, excluding those notices that do not - pertain to any part of the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must include - a readable copy of the attribution notices contained within such NOTICE - file, excluding those notices that do not pertain to any part of the - Derivative Works, in at least one of the following places: within a - NOTICE text file distributed as part of the Derivative Works; within the - Source form or documentation, if provided along with the Derivative - Works; or, within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents of the - NOTICE file are for informational purposes only and do not modify the - License. You may add Your own attribution notices within Derivative Works - that You distribute, alongside or as an addendum to the NOTICE text from - the Work, provided that such additional attribution notices cannot be - construed as modifying the License. - - You may add Your own copyright statement to Your modifications and may - provide additional or different license terms and conditions for use, - reproduction, or distribution of Your modifications, or for any such - Derivative Works as a whole, provided Your use, reproduction, and - distribution of the Work otherwise complies with the conditions stated in - this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, any - Contribution intentionally submitted for inclusion in the Work by You to the - Licensor shall be under the terms and conditions of this License, without - any additional terms or conditions. Notwithstanding the above, nothing - herein shall supersede or modify the terms of any separate license agreement - you may have executed with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, except - as required for reasonable and customary use in describing the origin of the - Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in - writing, Licensor provides the Work (and each Contributor provides its - Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied, including, without limitation, any - warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or - FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining - the appropriateness of using or redistributing the Work and assume any risks - associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, whether - in tort (including negligence), contract, or otherwise, unless required by - applicable law (such as deliberate and grossly negligent acts) or agreed to - in writing, shall any Contributor be liable to You for damages, including - any direct, indirect, special, incidental, or consequential damages of any - character arising as a result of this License or out of the use or inability - to use the Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all other - commercial damages or losses), even if such Contributor has been advised of - the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing the Work - or Derivative Works thereof, You may choose to offer, and charge a fee for, - acceptance of support, warranty, indemnity, or other liability obligations - and/or rights consistent with this License. However, in accepting such - obligations, You may act only on Your own behalf and on Your sole - responsibility, not on behalf of any other Contributor, and only if You - agree to indemnify, defend, and hold each Contributor harmless for any - liability incurred by, or claims asserted against, such Contributor by - reason of your accepting any such warranty or additional liability. END OF - TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - -To apply the Apache License to your work, attach the following boilerplate -notice, with the fields enclosed by brackets "[]" replaced with your own -identifying information. (Don't include the brackets!) The text should be -enclosed in the appropriate comment syntax for the file format. We also -recommend that a file or class name and description of purpose be included on -the same "printed page" as the copyright notice for easier identification -within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); - -you may not use this file except in compliance with the License. - -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software - -distributed under the License is distributed on an "AS IS" BASIS, - -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - -See the License for the specific language governing permissions and - -limitations under the License. - -* For aws-sdk-go see also this required NOTICE: - AWS SDK for Go - Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. - Copyright 2014-2015 Stripe, Inc. -* For docker/docker see also this required NOTICE: - Docker - Copyright 2012-2015 Docker, Inc. - - This product includes software developed at Docker, Inc. - (https://www.docker.com). - - This product contains software (https://github.com/kr/pty) developed - by Keith Rarick, licensed under the MIT License. - - The following is courtesy of our legal counsel: - - - Use and transfer of Docker may be subject to certain restrictions by the - United States and other governments. - It is your responsibility to ensure that your use and/or transfer does not - violate applicable laws. - - For more information, please see https://www.bis.doc.gov - - See also https://www.apache.org/dev/crypto.html and/or seek legal counsel. -* For github.com/coreos/go-systemd see also this required NOTICE: - CoreOS Project - Copyright 2018 CoreOS, Inc - - This product includes software developed at CoreOS, Inc. - (http://www.coreos.com/). -* For github.com/docker/go-connections see also this required NOTICE: - Apache License - Version 2.0, January 2004 - https://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other - modifications - represent, as a whole, an original work of authorship. For the - purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces - of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright - owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control - systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this - License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - Copyright 2015 Docker, Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -* For github.com/docker/go-plugins-helpers/ see also this required NOTICE: - Docker - Copyright 2012-2015 Docker, Inc. - - This product includes software developed at Docker, Inc. - (https://www.docker.com). - - This product contains software (https://github.com/kr/pty) developed - by Keith Rarick, licensed under the MIT License. - - The following is courtesy of our legal counsel: - - - Use and transfer of Docker may be subject to certain restrictions by the - United States and other governments. - It is your responsibility to ensure that your use and/or transfer does not - violate applicable laws. - - For more information, please see https://www.bis.doc.gov - - See also https://www.apache.org/dev/crypto.html and/or seek legal counsel. -* For github.com/golang/mock see also this required NOTICE: - Alex Reece - Google Inc. -* For github.com/opencontainers/go-digest see also this required NOTICE: - Copyright © 2016 Docker, Inc. -* For github.com/opencontainers/image-spec see also this required NOTICE: - Copyright 2016 The Linux Foundation. -* For github.com/opencontainers/runc see also this required NOTICE: - Copyright 2014 Docker, Inc. -* For go-ini/ini see also this required NOTICE: - Copyright 2016 -* For jmespath/go-jmespath see also this required NOTICE: - Copyright 2015 James Saryerwinnie - ------- - -** github.com/fsouza/go-dockerclient; version -d25e8d2941bd448756b336a2ec3abf79802d6ddf -- -https://github.com/fsouza/go-dockerclient -Copyright (c) 2013-2017, go-dockerclient authors -** github.com/pkg/errors; version c605e284fe17294bda444b34710735b29d1a9d90 -- -https://github.com/pkg/errors -Copyright (c) 2015, Dave Cheney - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ------- - -** github.com/pmezard/go-difflib; version v1.0.0 -- -https://github.com/pmezard/go-difflib -Copyright (c) 2013, Patrick Mezard - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - The names of its contributors may not be used to endorse or promote -products derived from this software without specific prior written -permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ------- - -** github.com/NVIDIA/gpu-monitoring-tools/; version master -- -https://github.com/NVIDIA/gpu-monitoring-tools/ -Copyright (c) 2018, NVIDIA Corporation -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -* Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ------- - -** github.com/cihub/seelog; version v2.6 -- https://github.com/cihub/seelog -Copyright (c) 2012, Cloud Instruments Co., Ltd. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ------- - -** github.com/davecgh/go-spew; version v1.1.1 -- -https://github.com/davecgh/go-spew -Copyright (c) 2012-2016 Dave Collins - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ------- - -** github.com/stretchr/testify; version v1.2.2 -- -https://github.com/stretchr/testify -Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell - -Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell - -Please consider promoting this project if you find it useful. - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of the Software, -and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT -OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ------- - -** github.com/Azure/go-ansiterm; version -fa152c58bc15761d0200cb75fe958b89a9d4888e -- -https://github.com/Azure/go-ansiterm -Copyright (c) 2015 Microsoft Corporation -** github.com/Microsoft/go-winio; version v0.3.6 -- -https://github.com/Microsoft/go-winio -Copyright (c) 2015 Microsoft -** logrus; version 0.11.5 -- https://github.com/sirupsen/logrus -Copyright (c) 2014 Simon Eskildsen - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/Makefile b/init_Makefile similarity index 100% rename from Makefile rename to init_Makefile diff --git a/scripts/analyze-cover-profile b/scripts/analyze-cover-profile deleted file mode 100755 index bf123f85fbd..00000000000 --- a/scripts/analyze-cover-profile +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python - -MINIMUM_TEST_COVERAGE = 76.7 - -# coverprofile.out (see Makefile for how this is generated) will look something like this: -# -# github.com/aws/amazon-ecs-agent/agent/wsclient/error.go:66: Retry 0.0% -# github.com/aws/amazon-ecs-agent/agent/wsclient/errors.go:23: Error 0.0% -# github.com/aws/amazon-ecs-agent/agent/wsclient/errors.go:28: Retry 0.0% -# github.com/aws/amazon-ecs-agent/agent/wsclient/errors.go:41: Retry 0.0% -# github.com/aws/amazon-ecs-agent/agent/wsclient/errors.go:46: Error 0.0% -# github.com/aws/amazon-ecs-agent/agent/wsclient/errors.go:59: Error 0.0% -# github.com/aws/amazon-ecs-agent/agent/wsclient/types.go:40: BuildTypeDecoder 100.0% -# github.com/aws/amazon-ecs-agent/agent/wsclient/types.go:49: NewOfType 0.0% -# github.com/aws/amazon-ecs-agent/agent/wsclient/types.go:57: GetRecognizedTypes 100.0% -# total: (statements) 73.8% - -with open("coverprofile.out") as f: - for line in f: - if line.startswith("total:"): - splitline = line.split() - print("Total unit test coverage: " + splitline[2]) - coverage = float(splitline[2].rstrip("%")) - if coverage < MINIMUM_TEST_COVERAGE: - raise BaseException( - "Unit test coverage ({0}%) is below the minimum ({1}%)". - format(coverage, MINIMUM_TEST_COVERAGE)) From 83d83957d6d1278fd4686fe02d40c9e568f08a2f Mon Sep 17 00:00:00 2001 From: lydiafilipe Date: Tue, 15 Mar 2022 00:13:02 +0000 Subject: [PATCH 2/5] temporarily remove static worflow check, which does not work for 1.51 --- .github/workflows/static.yml | 39 ------------------------------------ 1 file changed, 39 deletions(-) delete mode 100644 .github/workflows/static.yml diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml deleted file mode 100644 index f4acc72d84b..00000000000 --- a/.github/workflows/static.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Static Checks - -on: [push, pull_request] - -jobs: - static-check: - name: Static Analysis - runs-on: ubuntu-latest - steps: - - uses: actions/setup-go@v2 - with: - go-version: 1.15.4 - - uses: actions/checkout@v2 - with: - path: src/github.com/aws/amazon-ecs-agent - - name: run static checks - run: | - export GOPATH=$GITHUB_WORKSPACE - export PATH=$PATH:$(go env GOPATH)/bin - cd $GITHUB_WORKSPACE/src/github.com/aws/amazon-ecs-agent - make get-deps - make static-check - - x-platform-build: - name: Cross platform build - runs-on: ubuntu-latest - steps: - - uses: actions/setup-go@v2 - with: - go-version: 1.15.4 - - uses: actions/checkout@v2 - with: - submodules: true - path: src/github.com/aws/amazon-ecs-agent - - name: make xplatform-build - run: | - export GOPATH=$GITHUB_WORKSPACE - cd $GITHUB_WORKSPACE/src/github.com/aws/amazon-ecs-agent - make xplatform-build From ff591a840833ac74ce825e0cbed9a005ec9c5506 Mon Sep 17 00:00:00 2001 From: Lydia Filipe <26802011+lydiafilipe@users.noreply.github.com> Date: Fri, 25 Mar 2022 09:20:12 -0700 Subject: [PATCH 3/5] Updating import paths, file names, and Make targets for init (#3154) --- .github/workflows/static.yml | 58 +++++++++ .gitignore | 18 +++ .travis.yml | 14 -- Makefile | 121 +++++++++++++++++- README.md | 1 - ecs-init/cache/cache.go | 2 +- ecs-init/cache/cache_test.go | 2 +- ecs-init/docker/dependencies.go | 4 +- ecs-init/docker/docker.go | 6 +- ecs-init/docker/docker_suse_ubuntu.go | 2 +- ecs-init/docker/docker_test.go | 4 +- ecs-init/docker/docker_unspecified.go | 2 +- ecs-init/ecs-init.go | 6 +- ecs-init/engine/dependencies.go | 2 +- ecs-init/engine/dependencies_mocks.go | 2 +- ecs-init/engine/engine.go | 16 +-- ecs-init/engine/engine_test.go | 4 +- ecs-init/exec/exec.go | 2 +- ecs-init/exec/iptables/exec_mocks.go | 2 +- ecs-init/exec/iptables/iptables.go | 2 +- ecs-init/exec/sysctl/exec_mocks.go | 2 +- ecs-init/exec/sysctl/sysctl.go | 2 +- .../amazon-ecs-volume-plugin/plugin.go | 4 +- init_Makefile | 2 +- packaging/amazon-linux-ami/ecs-init.spec | 1 - packaging/suse/amazon-ecs-init.spec | 2 +- packaging/ubuntu-trusty/debian/control | 4 +- packaging/ubuntu-trusty/debian/copyright | 2 +- scripts/amazon-ecs-init.1 | 2 +- scripts/analyze-cover-profile-init | 29 +++++ .../{test.dockerfile => test-init.dockerfile} | 6 +- scripts/gobuild.sh | 8 +- scripts/{test => test-init} | 6 +- 33 files changed, 272 insertions(+), 68 deletions(-) create mode 100644 .github/workflows/static.yml delete mode 100644 .travis.yml create mode 100755 scripts/analyze-cover-profile-init rename scripts/dockerfiles/{test.dockerfile => test-init.dockerfile} (87%) rename scripts/{test => test-init} (92%) diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml new file mode 100644 index 00000000000..42160dbff29 --- /dev/null +++ b/.github/workflows/static.yml @@ -0,0 +1,58 @@ +name: Static Checks + +on: [push, pull_request] + +jobs: + static-check: + name: Static Analysis + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v2 + with: + go-version: 1.15.4 + - uses: actions/checkout@v2 + with: + path: src/github.com/aws/amazon-ecs-agent + - name: run static checks + run: | + export GOPATH=$GITHUB_WORKSPACE + export PATH=$PATH:$(go env GOPATH)/bin + cd $GITHUB_WORKSPACE/src/github.com/aws/amazon-ecs-agent + make get-deps + make static-check + + init-check: + name: Static Analysis Init + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v2 + with: + go-version: 1.15.4 + - uses: actions/checkout@v2 + with: + path: src/github.com/aws/amazon-ecs-agent + - name: run static checks + run: | + export GOPATH=$GITHUB_WORKSPACE + export PATH=$PATH:$(go env GOPATH)/bin + export GO111MODULE=auto + cd $GITHUB_WORKSPACE/src/github.com/aws/amazon-ecs-agent + make get-deps-init + make static-check-init + + x-platform-build: + name: Cross platform build + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v2 + with: + go-version: 1.15.4 + - uses: actions/checkout@v2 + with: + submodules: true + path: src/github.com/aws/amazon-ecs-agent + - name: make xplatform-build + run: | + export GOPATH=$GITHUB_WORKSPACE + cd $GITHUB_WORKSPACE/src/github.com/aws/amazon-ecs-agent + make xplatform-build diff --git a/.gitignore b/.gitignore index 6cdbe76d8ad..42faca1b80d 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,21 @@ _bin/ *.iml cover.out coverprofile.out +/amazon-ecs-init* +/BUILDROOT/ +/x86_64/ +/sources.tar +/ecs-init-* +/ecs.conf +/.deb-done +/.rpm-done +/.srpm-done +/BUILD +/RPMS +/SOURCES +/SRPMS +/ecs-init.spec +/sources.tgz +ecs-agent-*.tar +/ecs.service +*.log diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 357fa1a3b8e..00000000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: go -go_import_path: github.com/aws/amazon-ecs-init -sudo: false -go: - - 1.15 - -matrix: - include: - - os: linux - script: - - make get-deps - - make static-check - - make test - - make analyze-cover-profile diff --git a/Makefile b/Makefile index 727d7cd1f24..ab476f351be 100644 --- a/Makefile +++ b/Makefile @@ -45,6 +45,9 @@ gobuild: static: ./scripts/build +static-init: + ./scripts/gobuild.sh + # Cross-platform build target for static checks xplatform-build: GOOS=linux GOARCH=arm64 ./scripts/build true "" false @@ -114,6 +117,10 @@ gogenerate: go generate -x ./agent/... $(MAKE) goimports +gogenerate-init: + PATH=$(PATH):$(shell pwd)/scripts go generate -x ./ecs-init/... + $(MAKE) goimports + # 'go' may not be on the $PATH for sudo tests GO_EXECUTABLE=$(shell command -v go 2> /dev/null) @@ -135,6 +142,10 @@ test: ${GOTEST} -tags unit -coverprofile cover.out -timeout=60s ./agent/... go tool cover -func cover.out > coverprofile.out +test-init: + go test -count=1 -short -v -coverprofile cover.out ./ecs-init/... + go tool cover -func cover.out > coverprofile-init.out + test-silent: $(eval VERBOSE=) ${GOTEST} -tags unit -coverprofile cover.out -timeout=60s ./agent/... @@ -144,6 +155,10 @@ test-silent: analyze-cover-profile: coverprofile.out ./scripts/analyze-cover-profile +.PHONY: analyze-cover-profile-init +analyze-cover-profile-init: coverprofile-init.out + ./scripts/analyze-cover-profile-init + run-integ-tests: test-registry gremlin container-health-check-image run-sudo-tests ECS_LOGLEVEL=debug ${GOTEST} -tags integration -timeout=30m ./agent/... @@ -278,7 +293,31 @@ static-check: gocyclo govet importcheck gogenerate-check # use default checks of staticcheck tool, except style checks (-ST*) and depracation checks (-SA1019) # depracation checks have been left out for now; removing their warnings requires error handling for newer suggested APIs, changes in function signatures and their usages. # https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck - staticcheck -tests=false -checks "inherit,-ST*,-SA1019,-SA9002" ./agent/... + staticcheck -tests=false -checks "inherit,-ST*,-SA1019,-SA9002,-SA4006" ./agent/... + +# all .go files in the ecs-init +GOFILES_INIT:=$(shell go list -f '{{$$p := .}}{{range $$f := .GoFiles}}{{$$p.Dir}}/{{$$f}} {{end}}' ./ecs-init/...) +.PHONY: gocyclo-init +gocyclo-init: + # Run gocyclo over all .go files + gocyclo -over 12 ${GOFILES_INIT} + +.PHONY: govet-init +govet-init: + go vet ./ecs-init/... + +GOFMTFILES_INIT:=$(shell find ./ecs-init -not -path './ecs-init/vendor/*' -type f -iregex '.*\.go') + +.PHONY: importcheck-init +importcheck-init: + $(eval DIFFS:=$(shell goimports -l $(GOFMTFILES_INIT))) + @if [ -n "$(DIFFS)" ]; then echo "Files incorrectly formatted. Fix formatting by running goimports:"; echo "$(DIFFS)"; exit 1; fi + +.PHONY: static-check-init +static-check-init: gocyclo-init govet-init importcheck-init + # use default checks of staticcheck tool, except style checks (-ST*) + # https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck + staticcheck -tests=false -checks "inherit,-ST*" ./ecs-init/... .PHONY: goimports goimports: @@ -290,12 +329,19 @@ GOPATH=$(shell go env GOPATH) go get github.com/golang/mock/mockgen cd "${GOPATH}/src/github.com/golang/mock/mockgen" && git checkout 1.3.1 && go get ./... && go install ./... && cd - go get golang.org/x/tools/cmd/goimports - go get github.com/fzipp/gocyclo/cmd/gocyclo + GO111MODULE=on go get github.com/fzipp/gocyclo/cmd/gocyclo@v0.3.1 go get honnef.co/go/tools/cmd/staticcheck touch .get-deps-stamp get-deps: .get-deps-stamp +get-deps-init: + go get golang.org/x/tools/cover + go get golang.org/x/tools/cmd/cover + GO111MODULE=on go get github.com/fzipp/gocyclo/cmd/gocyclo@v0.3.1 + go get golang.org/x/tools/cmd/goimports + go get github.com/golang/mock/mockgen + go get honnef.co/go/tools/cmd/staticcheck PLATFORM:=$(shell uname -s) ifeq (${PLATFORM},Linux) @@ -313,6 +359,58 @@ bin/dep: curl -L https://github.com/golang/dep/releases/download/$(DEP_VERSION)/dep-${dep_arch} -o ./bin/dep chmod +x ./bin/dep +# init targets +sources.tgz: + ./scripts/update-version.sh + cp packaging/amazon-linux-ami/ecs-init.spec ecs-init.spec + cp packaging/amazon-linux-ami/ecs.conf ecs.conf + cp packaging/amazon-linux-ami/ecs.service ecs.service + cp packaging/amazon-linux-ami/amazon-ecs-volume-plugin.conf amazon-ecs-volume-plugin.conf + cp packaging/amazon-linux-ami/amazon-ecs-volume-plugin.service amazon-ecs-volume-plugin.service + cp packaging/amazon-linux-ami/amazon-ecs-volume-plugin.socket amazon-ecs-volume-plugin.socket + tar -czf ./sources.tgz ecs-init scripts + +# Hook to perform preparation steps prior to the sources target. +prepare-sources:: + +sources: prepare-sources sources.tgz + +.srpm-done: sources.tgz + test -e SOURCES || ln -s . SOURCES + rpmbuild --define "%_topdir $(PWD)" -bs ecs-init.spec + find SRPMS/ -type f -exec cp {} . \; + touch .srpm-done + +srpm: .srpm-done + +.rpm-done: sources.tgz + test -e SOURCES || ln -s . SOURCES + rpmbuild --define "%_topdir $(PWD)" -bb ecs-init.spec + find RPMS/ -type f -exec cp {} . \; + touch .rpm-done + +rpm: .rpm-done + +ubuntu-trusty: + cp packaging/ubuntu-trusty/ecs.conf ecs.conf + tar -czf ./amazon-ecs-init_${VERSION}.orig.tar.gz ecs-init ecs.conf scripts README.md + mkdir -p BUILDROOT + cp -r packaging/ubuntu-trusty/debian BUILDROOT/debian + cp -r ecs-init BUILDROOT + cp packaging/ubuntu-trusty/ecs.conf BUILDROOT + cp -r scripts BUILDROOT + cp README.md BUILDROOT + cd BUILDROOT && debuild $(shell [ "$(DEB_SIGN)" -ne "0" ] || echo "-uc -us") + +test-in-docker-init: + docker build -f scripts/dockerfiles/test-init.dockerfile -t "amazon/amazon-ecs-init-test:make" . + docker run -v "$(shell pwd):/go/src/github.com/aws/amazon-ecs-agent" "amazon/amazon-ecs-init-test:make" + +build-mock-images-init: + docker build -t "test.localhost/amazon/mock-ecs-agent" -f "scripts/dockerfiles/mock-agent.dockerfile" . + docker build -t "test.localhost/amazon/wants-update" -f "scripts/dockerfiles/wants-update.dockerfile" . + docker build -t "test.localhost/amazon/exit-success" -f "scripts/dockerfiles/exit-success.dockerfile" . + clean: # ensure docker is running and we can talk to it, abort if not: docker ps > /dev/null @@ -333,4 +431,21 @@ clean: -rm -rf $(PWD)/bin -rm -rf cover.out -rm -rf coverprofile.out - + # ecs init cleanup + -rm -f ecs-init.spec + -rm -f ecs.conf + -rm -f ecs.service + -rm -f amazon-ecs-volume-plugin.conf + -rm -f amazon-ecs-volume-plugin.service + -rm -f amazon-ecs-volume-plugin.socket + -rm -rf ./bin + -rm -f ./sources.tgz + -rm -f ./amazon-ecs-init + -rm -f ./ecs-agent-*.tar + -rm -f ./ecs-init-*.src.rpm + -rm -rf ./ecs-init-* + -rm -rf ./BUILDROOT BUILD RPMS SRPMS SOURCES SPECS + -rm -rf ./x86_64 + -rm -f ./amazon-ecs-init_${VERSION}* + -rm -f .srpm-done .rpm-done + -rm -rf coverprofile-init.out diff --git a/README.md b/README.md index 461ea1f963d..cfee0ef050a 100644 --- a/README.md +++ b/README.md @@ -242,7 +242,6 @@ The following targets are available. Each may be run with `make `. | `gobuild` | Runs a normal `go build` of the agent and stores the binary in `./out/amazon-ecs-agent` | | `static` | Runs `go build` to produce a static binary in `./out/amazon-ecs-agent` | | `test` | Runs all unit tests using `go test` | -| `test-in-docker` | Runs all tests inside a Docker container | | `run-integ-tests` | Runs all integration tests in the `engine` and `stats` packages | | `clean` | Removes build artifacts. *Note: this does not remove Docker images* | diff --git a/ecs-init/cache/cache.go b/ecs-init/cache/cache.go index 1c01feb2d01..552fcc39aff 100644 --- a/ecs-init/cache/cache.go +++ b/ecs-init/cache/cache.go @@ -23,7 +23,7 @@ import ( "os" "strings" - "github.com/aws/amazon-ecs-init/ecs-init/config" + "github.com/aws/amazon-ecs-agent/ecs-init/config" "github.com/aws/aws-sdk-go/aws/ec2metadata" "github.com/aws/aws-sdk-go/aws/session" diff --git a/ecs-init/cache/cache_test.go b/ecs-init/cache/cache_test.go index 62767d50d69..e9d9e8b4a06 100644 --- a/ecs-init/cache/cache_test.go +++ b/ecs-init/cache/cache_test.go @@ -24,7 +24,7 @@ import ( "os" "testing" - "github.com/aws/amazon-ecs-init/ecs-init/config" + "github.com/aws/amazon-ecs-agent/ecs-init/config" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" ) diff --git a/ecs-init/docker/dependencies.go b/ecs-init/docker/dependencies.go index e382f802125..c7f52b23e39 100644 --- a/ecs-init/docker/dependencies.go +++ b/ecs-init/docker/dependencies.go @@ -22,8 +22,8 @@ import ( "net/url" "time" - "github.com/aws/amazon-ecs-init/ecs-init/backoff" - "github.com/aws/amazon-ecs-init/ecs-init/config" + "github.com/aws/amazon-ecs-agent/ecs-init/backoff" + "github.com/aws/amazon-ecs-agent/ecs-init/config" log "github.com/cihub/seelog" godocker "github.com/fsouza/go-dockerclient" diff --git a/ecs-init/docker/docker.go b/ecs-init/docker/docker.go index 733b84ef053..0e685af9101 100644 --- a/ecs-init/docker/docker.go +++ b/ecs-init/docker/docker.go @@ -22,9 +22,9 @@ import ( "strings" "time" - "github.com/aws/amazon-ecs-init/ecs-init/backoff" - "github.com/aws/amazon-ecs-init/ecs-init/config" - "github.com/aws/amazon-ecs-init/ecs-init/gpu" + "github.com/aws/amazon-ecs-agent/ecs-init/backoff" + "github.com/aws/amazon-ecs-agent/ecs-init/config" + "github.com/aws/amazon-ecs-agent/ecs-init/gpu" log "github.com/cihub/seelog" godocker "github.com/fsouza/go-dockerclient" diff --git a/ecs-init/docker/docker_suse_ubuntu.go b/ecs-init/docker/docker_suse_ubuntu.go index 45ae84e4e41..e3cb30b1843 100644 --- a/ecs-init/docker/docker_suse_ubuntu.go +++ b/ecs-init/docker/docker_suse_ubuntu.go @@ -16,7 +16,7 @@ package docker import ( - "github.com/aws/amazon-ecs-init/ecs-init/config" + "github.com/aws/amazon-ecs-agent/ecs-init/config" godocker "github.com/fsouza/go-dockerclient" ) diff --git a/ecs-init/docker/docker_test.go b/ecs-init/docker/docker_test.go index 15be8af92bb..e35c4fecbe6 100644 --- a/ecs-init/docker/docker_test.go +++ b/ecs-init/docker/docker_test.go @@ -20,8 +20,8 @@ import ( "path/filepath" "testing" - "github.com/aws/amazon-ecs-init/ecs-init/config" - "github.com/aws/amazon-ecs-init/ecs-init/gpu" + "github.com/aws/amazon-ecs-agent/ecs-init/config" + "github.com/aws/amazon-ecs-agent/ecs-init/gpu" godocker "github.com/fsouza/go-dockerclient" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" diff --git a/ecs-init/docker/docker_unspecified.go b/ecs-init/docker/docker_unspecified.go index 2cd017d9198..5637c0230eb 100644 --- a/ecs-init/docker/docker_unspecified.go +++ b/ecs-init/docker/docker_unspecified.go @@ -16,7 +16,7 @@ package docker import ( - "github.com/aws/amazon-ecs-init/ecs-init/config" + "github.com/aws/amazon-ecs-agent/ecs-init/config" godocker "github.com/fsouza/go-dockerclient" ) diff --git a/ecs-init/ecs-init.go b/ecs-init/ecs-init.go index a8c0d71b8ef..ecf0c7c56e6 100644 --- a/ecs-init/ecs-init.go +++ b/ecs-init/ecs-init.go @@ -18,9 +18,9 @@ import ( "fmt" "os" - "github.com/aws/amazon-ecs-init/ecs-init/config" - "github.com/aws/amazon-ecs-init/ecs-init/engine" - "github.com/aws/amazon-ecs-init/ecs-init/version" + "github.com/aws/amazon-ecs-agent/ecs-init/config" + "github.com/aws/amazon-ecs-agent/ecs-init/engine" + "github.com/aws/amazon-ecs-agent/ecs-init/version" log "github.com/cihub/seelog" ) diff --git a/ecs-init/engine/dependencies.go b/ecs-init/engine/dependencies.go index 2512f2f9fda..e5499885ade 100644 --- a/ecs-init/engine/dependencies.go +++ b/ecs-init/engine/dependencies.go @@ -16,7 +16,7 @@ package engine import ( "io" - "github.com/aws/amazon-ecs-init/ecs-init/cache" + "github.com/aws/amazon-ecs-agent/ecs-init/cache" ) //go:generate mockgen.sh $GOPACKAGE $GOFILE diff --git a/ecs-init/engine/dependencies_mocks.go b/ecs-init/engine/dependencies_mocks.go index 0579fbc0ceb..a3646d5b6ab 100644 --- a/ecs-init/engine/dependencies_mocks.go +++ b/ecs-init/engine/dependencies_mocks.go @@ -21,7 +21,7 @@ import ( io "io" reflect "reflect" - cache "github.com/aws/amazon-ecs-init/ecs-init/cache" + cache "github.com/aws/amazon-ecs-agent/ecs-init/cache" gomock "github.com/golang/mock/gomock" ) diff --git a/ecs-init/engine/engine.go b/ecs-init/engine/engine.go index 3550fdb1435..38623bd6604 100644 --- a/ecs-init/engine/engine.go +++ b/ecs-init/engine/engine.go @@ -20,14 +20,14 @@ import ( "math" "time" - "github.com/aws/amazon-ecs-init/ecs-init/backoff" - "github.com/aws/amazon-ecs-init/ecs-init/cache" - "github.com/aws/amazon-ecs-init/ecs-init/config" - "github.com/aws/amazon-ecs-init/ecs-init/docker" - "github.com/aws/amazon-ecs-init/ecs-init/exec" - "github.com/aws/amazon-ecs-init/ecs-init/exec/iptables" - "github.com/aws/amazon-ecs-init/ecs-init/exec/sysctl" - "github.com/aws/amazon-ecs-init/ecs-init/gpu" + "github.com/aws/amazon-ecs-agent/ecs-init/backoff" + "github.com/aws/amazon-ecs-agent/ecs-init/cache" + "github.com/aws/amazon-ecs-agent/ecs-init/config" + "github.com/aws/amazon-ecs-agent/ecs-init/docker" + "github.com/aws/amazon-ecs-agent/ecs-init/exec" + "github.com/aws/amazon-ecs-agent/ecs-init/exec/iptables" + "github.com/aws/amazon-ecs-agent/ecs-init/exec/sysctl" + "github.com/aws/amazon-ecs-agent/ecs-init/gpu" log "github.com/cihub/seelog" ) diff --git a/ecs-init/engine/engine_test.go b/ecs-init/engine/engine_test.go index 99129df7732..4d9ded6500c 100644 --- a/ecs-init/engine/engine_test.go +++ b/ecs-init/engine/engine_test.go @@ -21,8 +21,8 @@ import ( "os" "testing" - "github.com/aws/amazon-ecs-init/ecs-init/cache" - "github.com/aws/amazon-ecs-init/ecs-init/gpu" + "github.com/aws/amazon-ecs-agent/ecs-init/cache" + "github.com/aws/amazon-ecs-agent/ecs-init/gpu" "github.com/golang/mock/gomock" ) diff --git a/ecs-init/exec/exec.go b/ecs-init/exec/exec.go index 3ba1fc73c7d..f700fa329ea 100644 --- a/ecs-init/exec/exec.go +++ b/ecs-init/exec/exec.go @@ -16,7 +16,7 @@ package exec import ( osexec "os/exec" - "github.com/aws/amazon-ecs-init/ecs-init/cmd" + "github.com/aws/amazon-ecs-agent/ecs-init/cmd" ) //go:generate mockgen.sh sysctl $GOFILE sysctl diff --git a/ecs-init/exec/iptables/exec_mocks.go b/ecs-init/exec/iptables/exec_mocks.go index 684f83d51c6..ef516d91f69 100644 --- a/ecs-init/exec/iptables/exec_mocks.go +++ b/ecs-init/exec/iptables/exec_mocks.go @@ -20,7 +20,7 @@ package iptables import ( reflect "reflect" - cmd "github.com/aws/amazon-ecs-init/ecs-init/cmd" + cmd "github.com/aws/amazon-ecs-agent/ecs-init/cmd" gomock "github.com/golang/mock/gomock" ) diff --git a/ecs-init/exec/iptables/iptables.go b/ecs-init/exec/iptables/iptables.go index 57b4518fc44..c7787dcfb83 100644 --- a/ecs-init/exec/iptables/iptables.go +++ b/ecs-init/exec/iptables/iptables.go @@ -19,7 +19,7 @@ import ( "strconv" "strings" - "github.com/aws/amazon-ecs-init/ecs-init/exec" + "github.com/aws/amazon-ecs-agent/ecs-init/exec" log "github.com/cihub/seelog" "github.com/pkg/errors" ) diff --git a/ecs-init/exec/sysctl/exec_mocks.go b/ecs-init/exec/sysctl/exec_mocks.go index 75b851e2db3..2c24e8bfe9f 100644 --- a/ecs-init/exec/sysctl/exec_mocks.go +++ b/ecs-init/exec/sysctl/exec_mocks.go @@ -20,7 +20,7 @@ package sysctl import ( reflect "reflect" - cmd "github.com/aws/amazon-ecs-init/ecs-init/cmd" + cmd "github.com/aws/amazon-ecs-agent/ecs-init/cmd" gomock "github.com/golang/mock/gomock" ) diff --git a/ecs-init/exec/sysctl/sysctl.go b/ecs-init/exec/sysctl/sysctl.go index ad3a6c421a5..8a694521b60 100644 --- a/ecs-init/exec/sysctl/sysctl.go +++ b/ecs-init/exec/sysctl/sysctl.go @@ -18,7 +18,7 @@ import ( "strconv" "strings" - "github.com/aws/amazon-ecs-init/ecs-init/exec" + "github.com/aws/amazon-ecs-agent/ecs-init/exec" log "github.com/cihub/seelog" ) diff --git a/ecs-init/volumes/amazon-ecs-volume-plugin/plugin.go b/ecs-init/volumes/amazon-ecs-volume-plugin/plugin.go index d79b33072aa..97f7ad4aad9 100644 --- a/ecs-init/volumes/amazon-ecs-volume-plugin/plugin.go +++ b/ecs-init/volumes/amazon-ecs-volume-plugin/plugin.go @@ -18,8 +18,8 @@ import ( "os/user" "strconv" - "github.com/aws/amazon-ecs-init/ecs-init/volumes" - "github.com/aws/amazon-ecs-init/ecs-init/volumes/logger" + "github.com/aws/amazon-ecs-agent/ecs-init/volumes" + "github.com/aws/amazon-ecs-agent/ecs-init/volumes/logger" "github.com/cihub/seelog" "github.com/docker/go-plugins-helpers/volume" ) diff --git a/init_Makefile b/init_Makefile index 08fe1eddc27..849d24c5510 100644 --- a/init_Makefile +++ b/init_Makefile @@ -75,7 +75,7 @@ static-check: gocyclo govet importcheck test-in-docker: docker build -f scripts/dockerfiles/test.dockerfile -t "amazon/amazon-ecs-init-test:make" . - docker run -v "$(shell pwd):/go/src/github.com/aws/amazon-ecs-init" "amazon/amazon-ecs-init-test:make" + docker run -v "$(shell pwd):/go/src/github.com/aws/amazon-ecs-agent" "amazon/amazon-ecs-init-test:make" build-mock-images: docker build -t "test.localhost/amazon/mock-ecs-agent" -f "scripts/dockerfiles/mock-agent.dockerfile" . diff --git a/packaging/amazon-linux-ami/ecs-init.spec b/packaging/amazon-linux-ami/ecs-init.spec index 2ff24a85b77..2d941b799b5 100644 --- a/packaging/amazon-linux-ami/ecs-init.spec +++ b/packaging/amazon-linux-ami/ecs-init.spec @@ -49,7 +49,6 @@ Source5: amazon-ecs-volume-plugin.conf Source6: amazon-ecs-volume-plugin.service Source7: amazon-ecs-volume-plugin.socket -BuildRequires: golang >= 1.7 %if %{with systemd} BuildRequires: systemd Requires: systemd diff --git a/packaging/suse/amazon-ecs-init.spec b/packaging/suse/amazon-ecs-init.spec index e00d6a5f84d..4706ca0d1cb 100644 --- a/packaging/suse/amazon-ecs-init.spec +++ b/packaging/suse/amazon-ecs-init.spec @@ -22,7 +22,7 @@ Release: 0 Summary: Amazon Elastic Container Service Initialization License: Apache-2.0 Group: System Environment/Base -Url: https://github.com/aws/amazon-ecs-init +Url: https://github.com/aws/amazon-ecs-agent Source0: %{name}-%{version}.tar.gz Source1: %{short_name}.service BuildRequires: go diff --git a/packaging/ubuntu-trusty/debian/control b/packaging/ubuntu-trusty/debian/control index b1ee26571f8..1facd140b09 100644 --- a/packaging/ubuntu-trusty/debian/control +++ b/packaging/ubuntu-trusty/debian/control @@ -5,8 +5,8 @@ Maintainer: Samuel Karp Build-Depends: debhelper (>= 9.0.0), golang-1.7 (>= 1.7) Standards-Version: 3.9.5 Homepage: https://aws.amazon.com/ecs -Vcs-Git: git://github.com/aws/amazon-ecs-init.git -Vcs-Browser: http://github.com/aws/amazon-ecs-init +Vcs-Git: git://github.com/aws/amazon-ecs-agent.git +Vcs-Browser: http://github.com/aws/amazon-ecs-agent Package: amazon-ecs-init Architecture: amd64 diff --git a/packaging/ubuntu-trusty/debian/copyright b/packaging/ubuntu-trusty/debian/copyright index b797faf93ed..7bf5a6ae409 100644 --- a/packaging/ubuntu-trusty/debian/copyright +++ b/packaging/ubuntu-trusty/debian/copyright @@ -1,6 +1,6 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: amazon-ecs-init -Source: https://github.com/aws/amazon-ecs-init +Source: https://github.com/aws/amazon-ecs-agent Files: * Copyright: 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/scripts/amazon-ecs-init.1 b/scripts/amazon-ecs-init.1 index f043e4a56d8..857a1f68183 100644 --- a/scripts/amazon-ecs-init.1 +++ b/scripts/amazon-ecs-init.1 @@ -109,5 +109,5 @@ https://github.com/aws/amazon-ecs-agent .TP Amazon ECS Init \- Source Repository .nh -https://github.com/aws/amazon-ecs-init +https://github.com/aws/amazon-ecs-agent .TP diff --git a/scripts/analyze-cover-profile-init b/scripts/analyze-cover-profile-init new file mode 100755 index 00000000000..a529bbd5302 --- /dev/null +++ b/scripts/analyze-cover-profile-init @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +MINIMUM_TEST_COVERAGE = 76.7 + +# coverprofile.out (see Makefile for how this is generated) will look something like this: +# +# github.com/aws/amazon-ecs-agent/agent/wsclient/error.go:66: Retry 0.0% +# github.com/aws/amazon-ecs-agent/agent/wsclient/errors.go:23: Error 0.0% +# github.com/aws/amazon-ecs-agent/agent/wsclient/errors.go:28: Retry 0.0% +# github.com/aws/amazon-ecs-agent/agent/wsclient/errors.go:41: Retry 0.0% +# github.com/aws/amazon-ecs-agent/agent/wsclient/errors.go:46: Error 0.0% +# github.com/aws/amazon-ecs-agent/agent/wsclient/errors.go:59: Error 0.0% +# github.com/aws/amazon-ecs-agent/agent/wsclient/types.go:40: BuildTypeDecoder 100.0% +# github.com/aws/amazon-ecs-agent/agent/wsclient/types.go:49: NewOfType 0.0% +# github.com/aws/amazon-ecs-agent/agent/wsclient/types.go:57: GetRecognizedTypes 100.0% +# total: (statements) 73.8% + +with open("coverprofile-init.out") as f: + for line in f: + if line.startswith("total:"): + splitline = line.split() + print("Total unit test coverage: " + splitline[2]) + coverage = float(splitline[2].rstrip("%")) + if coverage < MINIMUM_TEST_COVERAGE: + raise BaseException( + "Unit test coverage ({0}%) is below the minimum ({1}%)". + format(coverage, MINIMUM_TEST_COVERAGE)) + + diff --git a/scripts/dockerfiles/test.dockerfile b/scripts/dockerfiles/test-init.dockerfile similarity index 87% rename from scripts/dockerfiles/test.dockerfile rename to scripts/dockerfiles/test-init.dockerfile index e26c34e704d..b6b5e5ef225 100644 --- a/scripts/dockerfiles/test.dockerfile +++ b/scripts/dockerfiles/test-init.dockerfile @@ -17,10 +17,10 @@ # Because the Agent's tests include starting docker containers, it is necessary # to have both go and docker available in the testing environment. # It's easier to get go, so start with docker-in-docker and add go on top -FROM golang:1.9 +FROM golang:1.15.4 MAINTAINER Amazon Web Services, Inc. RUN mkdir -p /go/src/github.com/aws/ -WORKDIR /go/src/github.com/aws/amazon-ecs-init +WORKDIR /go/src/github.com/aws/amazon-ecs-agent -ENTRYPOINT /go/src/github.com/aws/amazon-ecs-init/scripts/test +ENTRYPOINT /go/src/github.com/aws/amazon-ecs-agent/scripts/test-init diff --git a/scripts/gobuild.sh b/scripts/gobuild.sh index ff9a9ac5b8a..fc6c7e955ce 100755 --- a/scripts/gobuild.sh +++ b/scripts/gobuild.sh @@ -17,7 +17,7 @@ set -e export TOPWD="$(pwd)" export BUILDDIR="$(mktemp -d)" export GOPATH="${TOPWD}/ecs-init/:${BUILDDIR}" -export SRCPATH="${BUILDDIR}/src/github.com/aws/amazon-ecs-init" +export SRCPATH="${BUILDDIR}/src/github.com/aws/amazon-ecs-agent" if [ -d "${TOPWD}/.git" ]; then version=$(cat "${TOPWD}/ecs-init/ECSVERSION") @@ -28,9 +28,9 @@ if [ -d "${TOPWD}/.git" ]; then git_dirty=true fi - VERSION_FLAG="-X github.com/aws/amazon-ecs-init/ecs-init/version.Version=${version}" - GIT_HASH_FLAG="-X github.com/aws/amazon-ecs-init/ecs-init/version.GitShortHash=${git_hash}" - GIT_DIRTY_FLAG="-X github.com/aws/amazon-ecs-init/ecs-init/version.GitDirty=${git_dirty}" + VERSION_FLAG="-X github.com/aws/amazon-ecs-agent/ecs-init/version.Version=${version}" + GIT_HASH_FLAG="-X github.com/aws/amazon-ecs-agent/ecs-init/version.GitShortHash=${git_hash}" + GIT_DIRTY_FLAG="-X github.com/aws/amazon-ecs-agent/ecs-init/version.GitDirty=${git_dirty}" fi mkdir -p "${SRCPATH}" diff --git a/scripts/test b/scripts/test-init similarity index 92% rename from scripts/test rename to scripts/test-init index 9478a147a8f..72c7f74541b 100755 --- a/scripts/test +++ b/scripts/test-init @@ -12,6 +12,6 @@ # express or implied. See the License for the specific language governing # permissions and limitations under the License. set -x -make get-deps -make govet -make test +make get-deps-init +make govet-init +make test-init From 364bd9cad1ebaeecdac53011cbde4b2786f42605 Mon Sep 17 00:00:00 2001 From: Lydia Filipe <26802011+lydiafilipe@users.noreply.github.com> Date: Mon, 28 Mar 2022 09:37:56 -0700 Subject: [PATCH 4/5] dockerfree build for legacy agent (#3158) --- Makefile | 25 +++++++++++ agent-container/agent-config.json | 1 + agent-container/agent-image-VERSION | 1 + agent-container/agent-manifest.json | 1 + agent-container/agent-repositories | 1 + misc/pause-container/pause-config.json | 1 + misc/pause-container/pause-image-VERSION | 1 + misc/pause-container/pause-manifest.json | 1 + misc/pause-container/pause-repositories | 1 + scripts/build | 9 ++++ scripts/build-agent-image | 56 ++++++++++++++++++++++++ scripts/build-cni-plugins | 31 +++++++++++++ scripts/build-pause | 32 ++++++++++++++ scripts/get-host-certs | 43 ++++++++++++++++++ 14 files changed, 204 insertions(+) create mode 100644 agent-container/agent-config.json create mode 100644 agent-container/agent-image-VERSION create mode 100644 agent-container/agent-manifest.json create mode 100644 agent-container/agent-repositories create mode 100644 misc/pause-container/pause-config.json create mode 100644 misc/pause-container/pause-image-VERSION create mode 100644 misc/pause-container/pause-manifest.json create mode 100644 misc/pause-container/pause-repositories create mode 100755 scripts/build-agent-image create mode 100755 scripts/build-cni-plugins create mode 100755 scripts/build-pause create mode 100755 scripts/get-host-certs diff --git a/Makefile b/Makefile index ab476f351be..de05ebc7aa2 100644 --- a/Makefile +++ b/Makefile @@ -48,6 +48,9 @@ static: static-init: ./scripts/gobuild.sh +static-with-pause: + ./scripts/build true "" false true + # Cross-platform build target for static checks xplatform-build: GOOS=linux GOARCH=arm64 ./scripts/build true "" false @@ -411,6 +414,22 @@ build-mock-images-init: docker build -t "test.localhost/amazon/wants-update" -f "scripts/dockerfiles/wants-update.dockerfile" . docker build -t "test.localhost/amazon/exit-success" -f "scripts/dockerfiles/exit-success.dockerfile" . +# Dockerfree targets +# TODO: arm +dockerfree-pause: + GOOS=linux GOARCH=amd64 ./scripts/build-pause + +dockerfree-certs: + GOOS=linux GOARCH=amd64 ./scripts/get-host-certs + +dockerfree-cni-plugins: get-cni-sources + GOOS=linux GOARCH=amd64 ./scripts/build-cni-plugins + +dockerfree-agent-image: dockerfree-pause dockerfree-certs dockerfree-cni-plugins static-with-pause + GOOS=linux GOARCH=amd64 ./scripts/build-agent-image + +dockerfree-all: dockerfree-agent-image rpm + clean: # ensure docker is running and we can talk to it, abort if not: docker ps > /dev/null @@ -449,3 +468,9 @@ clean: -rm -f ./amazon-ecs-init_${VERSION}* -rm -f .srpm-done .rpm-done -rm -rf coverprofile-init.out + -rm -f misc/certs/host-certs.crt &> /dev/null + -rm -rf misc/pause-container/image/ + -rm -rf misc/pause-container/rootfs/ + -rm -rf misc/plugins/ + -rm -f misc/pause-container/amazon-ecs-pause.tar + -rm -rf rootfs/ diff --git a/agent-container/agent-config.json b/agent-container/agent-config.json new file mode 100644 index 00000000000..247223602b5 --- /dev/null +++ b/agent-container/agent-config.json @@ -0,0 +1 @@ +{"author":"Amazon Web Services, Inc.","config":{"Cmd":["/agent"],"ArgsEscaped":true},"created":"~~timestamp~~","history":[{"created":"~~timestamp~~","author":"Amazon Web Services, Inc.","created_by":"p=np","empty_layer":true}],"os":"linux","rootfs":{"type":"layers","diff_ids":["sha256:~~digest~~"]}} diff --git a/agent-container/agent-image-VERSION b/agent-container/agent-image-VERSION new file mode 100644 index 00000000000..d3827e75a5c --- /dev/null +++ b/agent-container/agent-image-VERSION @@ -0,0 +1 @@ +1.0 diff --git a/agent-container/agent-manifest.json b/agent-container/agent-manifest.json new file mode 100644 index 00000000000..840d0392d65 --- /dev/null +++ b/agent-container/agent-manifest.json @@ -0,0 +1 @@ +[{"Config":"config.json","RepoTags":["amazon/amazon-ecs-agent:~~agentversion~~"],"Layers":["rootfs/layer.tar"]}] diff --git a/agent-container/agent-repositories b/agent-container/agent-repositories new file mode 100644 index 00000000000..91624061cc3 --- /dev/null +++ b/agent-container/agent-repositories @@ -0,0 +1 @@ +{"amazon/amazon-ecs-agent":{"amazon-ecs":"rootfs"}} diff --git a/misc/pause-container/pause-config.json b/misc/pause-container/pause-config.json new file mode 100644 index 00000000000..a54495b9b75 --- /dev/null +++ b/misc/pause-container/pause-config.json @@ -0,0 +1 @@ +{"author":"Amazon Web Services, Inc.","config":{"Cmd":["/pause"],"ArgsEscaped":true},"created":"2014-12-12T01:12:53.332832423Z","history":[{"created":"2014-12-12T01:12:53.332832423Z","author":"Amazon Web Services, Inc.","created_by":"p=np","empty_layer":true}],"os":"linux","rootfs":{"type":"layers","diff_ids":["sha256:~~digest~~"]}} diff --git a/misc/pause-container/pause-image-VERSION b/misc/pause-container/pause-image-VERSION new file mode 100644 index 00000000000..d3827e75a5c --- /dev/null +++ b/misc/pause-container/pause-image-VERSION @@ -0,0 +1 @@ +1.0 diff --git a/misc/pause-container/pause-manifest.json b/misc/pause-container/pause-manifest.json new file mode 100644 index 00000000000..8fa5abcbf54 --- /dev/null +++ b/misc/pause-container/pause-manifest.json @@ -0,0 +1 @@ +[{"Config":"config.json","RepoTags":["amazon/amazon-ecs-pause:0.1.0"],"Layers":["rootfs/layer.tar"]}] diff --git a/misc/pause-container/pause-repositories b/misc/pause-container/pause-repositories new file mode 100644 index 00000000000..e2564e0b801 --- /dev/null +++ b/misc/pause-container/pause-repositories @@ -0,0 +1 @@ +{"amazon/amazon-ecs-pause":{"amazon-ecs":"rootfs"}} diff --git a/scripts/build b/scripts/build index 2cab3e99032..be89a19532f 100755 --- a/scripts/build +++ b/scripts/build @@ -25,6 +25,11 @@ set -ex static=${1:-true} output_directory=${2:-} version_gen=${3:-true} +with_pause=${4:-false} + +PAUSE_CONTAINER_IMAGE="amazon/amazon-ecs-pause" +PAUSE_CONTAINER_TAG="0.1.0" +PAUSE_CONTAINER_TARBALL="amazon-ecs-pause.tar" # Normalize to working directory being build root (up one level from ./scripts) ROOT=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd ) @@ -40,6 +45,10 @@ if [[ "${version_gen}" == "true" ]]; then go run gen/version-gen.go fi +if [[ "${with_pause}" == "true" ]]; then + LDFLAGS="-X github.com/aws/amazon-ecs-agent/agent/config.DefaultPauseContainerTag=$PAUSE_CONTAINER_TAG -X github.com/aws/amazon-ecs-agent/agent/config.DefaultPauseContainerImageName=$PAUSE_CONTAINER_IMAGE" +fi + if [ "${TARGET_OS}" == "windows" ]; then unset static build_exe="out/amazon-ecs-agent.exe" diff --git a/scripts/build-agent-image b/scripts/build-agent-image new file mode 100755 index 00000000000..32f18926128 --- /dev/null +++ b/scripts/build-agent-image @@ -0,0 +1,56 @@ +#!/bin/bash +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You may +# not use this file except in compliance with the License. A copy of the +# License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is distributed +# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +# express or implied. See the License for the specific language governing +# permissions and limitations under the License. + +# This script builds a copy of the agent. +# It exists to wrap go build and properly make a static binary, as well as to +# correctly setup versioning before creating the binary + +set -ex + +ROOT=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd ) +cd "${ROOT}" +AGENT_VERSION=$(cat VERSION) + +# add cni-plugins +mkdir -p rootfs/amazon-ecs-cni-plugins/ +cp ./misc/plugins/aws-appmesh rootfs/amazon-ecs-cni-plugins/aws-appmesh +cp ./misc/plugins/ecs-bridge rootfs/amazon-ecs-cni-plugins/ecs-bridge +cp ./misc/plugins/ecs-eni rootfs/amazon-ecs-cni-plugins/ecs-eni +cp ./misc/plugins/ecs-ipam rootfs/amazon-ecs-cni-plugins/ecs-ipam +cp ./misc/plugins/vpc-branch-eni rootfs/amazon-ecs-cni-plugins/vpc-branch-eni + +# add certs +mkdir -p rootfs/etc/ssl/certs/ +cp ./misc/certs/host-certs.crt rootfs/etc/ssl/certs/ca-certificates.crt + +# add pause container +mkdir -p rootfs/images/ +cp ./misc/pause-container/amazon-ecs-pause.tar rootfs/images/amazon-ecs-pause.tar + +# add agent +cp ./out/amazon-ecs-agent rootfs/agent + +# build container +mkdir -p image/rootfs +tar --mtime="@1492525740" --owner=0 --group=0 --numeric-owner -cf image/rootfs/layer.tar -C rootfs . +DIGEST=$(sha256sum image/rootfs/layer.tar | sed -e 's/ .*//') +install -m 0644 ./agent-container/agent-image-VERSION image/rootfs/VERSION +install -m 0644 ./agent-container/agent-config.json image/config.json +sed -i "s/~~digest~~/${DIGEST}/" image/config.json +sed -i "s/~~timestamp~~/$(date +"%FT%T.%NZ")/g" image/config.json +install -m 0644 ./agent-container/agent-manifest.json image/manifest.json +sed -i "s/~~agentversion~~/${AGENT_VERSION}/" image/manifest.json +install -m 0644 ./agent-container/agent-repositories image/repositories +tar --mtime="@1492525740" --owner=0 --group=0 --numeric-owner -cf ./ecs-agent-v${AGENT_VERSION}.tar -C image . +rm -rf image/ diff --git a/scripts/build-cni-plugins b/scripts/build-cni-plugins new file mode 100755 index 00000000000..b21160ffbd1 --- /dev/null +++ b/scripts/build-cni-plugins @@ -0,0 +1,31 @@ +#!/bin/bash +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You may +# not use this file except in compliance with the License. A copy of the +# License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is distributed +# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +# express or implied. See the License for the specific language governing +# permissions and limitations under the License. + +# this script builds the ecs/vpc cni plugins from the submodules +# by copying them out of agent into their expected location in the +# gopath + +set -ex + +ROOT=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd ) +cd "${ROOT}" +# copy submodules to expected go build path github.com/aws/amazon-ecs-cni-plugins +cp -r amazon-ecs-cni-plugins ../amazon-ecs-cni-plugins +cp -r amazon-vpc-cni-plugins ../amazon-vpc-cni-plugins +cd ../amazon-ecs-cni-plugins && GO111MODULE=auto make plugins +mkdir -p ../amazon-ecs-agent/misc/plugins && cp -a ./bin/plugins/. ../amazon-ecs-agent/misc/plugins/ +make clean +cd ../amazon-vpc-cni-plugins && GO111MODULE=auto make build +cp -a ./build/linux_amd64/. ../amazon-ecs-agent/misc/plugins/ +make clean diff --git a/scripts/build-pause b/scripts/build-pause new file mode 100755 index 00000000000..d013a6b65f4 --- /dev/null +++ b/scripts/build-pause @@ -0,0 +1,32 @@ +#!/bin/bash +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You may +# not use this file except in compliance with the License. A copy of the +# License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is distributed +# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +# express or implied. See the License for the specific language governing +# permissions and limitations under the License. + +# This script builds the pause container without Docker +# The pause container configuration is static, except for the DIGEST + +set -ex + +ROOT=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd ) +cd "${ROOT}/misc/pause-container" +mkdir -p rootfs/ +gcc -static pause.c -o rootfs/pause +mkdir -p image/rootfs +tar --mtime="@1492525740" --owner=0 --group=0 --numeric-owner -cf image/rootfs/layer.tar -C rootfs . +DIGEST=$(sha256sum image/rootfs/layer.tar | sed -e 's/ .*//') +install -m 0644 pause-image-VERSION image/rootfs/VERSION +install -m 0644 pause-config.json image/config.json +sed -i "s/~~digest~~/${DIGEST}/" image/config.json +install -m 0644 pause-manifest.json image/manifest.json +install -m 0644 pause-repositories image/repositories +tar --mtime="@1492525740" --owner=0 --group=0 --numeric-owner -cf ./amazon-ecs-pause.tar -C image . diff --git a/scripts/get-host-certs b/scripts/get-host-certs new file mode 100755 index 00000000000..c536d94ea9b --- /dev/null +++ b/scripts/get-host-certs @@ -0,0 +1,43 @@ +#!/bin/bash +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You may +# not use this file except in compliance with the License. A copy of the +# License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is distributed +# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +# express or implied. See the License for the specific language governing +# permissions and limitations under the License. +# +# this script searches through known locations for certs (borrowed from +# https://go.dev/src/crypto/x509/root_linux.go) and writes them to the +# current dir + +set -ex + +ROOT=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd ) +cd "${ROOT}/misc/certs" + +# Possible certificate files +certFiles=("/etc/ssl/certs/ca-certificates.crt" "/etc/pki/tls/certs/ca-bundle.crt" "/etc/ssl/ca-bundle.pem" "/etc/pki/tls/cacert.pem" "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" "/etc/ssl/cert.pem") + +# search and stop once certs are found +thisCertFile="" +for file in ${certFiles[@]}; do + if test -f $file; then + thisCertFile=$file + break + fi +done + +# if we found a cert file, we'll copy else exit unsuccessfully +if [ ! -z "$thisCertFile" ] +then + cp $thisCertFile ./host-certs.crt +else + echo "No certs file found on host" + exit 1 +fi From 03c0dac4a3c4e0ca39189d3951426264b990b3e0 Mon Sep 17 00:00:00 2001 From: Lydia Filipe Date: Fri, 1 Apr 2022 18:15:56 +0000 Subject: [PATCH 5/5] specfile and script updates for integrated init/agent build --- Makefile | 31 ++-- agent-container/agent-manifest.json | 2 +- .../amazon-ecs-volume-plugin.conf | 22 +++ .../amazon-ecs-volume-plugin.service | 27 +++ .../amazon-ecs-volume-plugin.socket | 23 +++ .../amazon-linux-ami-integrated/ecs-init.spec | 167 ++++++++++++++++++ .../amazon-linux-ami-integrated/ecs.conf | 22 +++ .../amazon-linux-ami-integrated/ecs.service | 34 ++++ packaging/amazon-linux-ami/ecs-init.spec | 1 + scripts/build | 11 ++ scripts/build-cni-plugins | 26 +-- 11 files changed, 343 insertions(+), 23 deletions(-) create mode 100644 packaging/amazon-linux-ami-integrated/amazon-ecs-volume-plugin.conf create mode 100644 packaging/amazon-linux-ami-integrated/amazon-ecs-volume-plugin.service create mode 100644 packaging/amazon-linux-ami-integrated/amazon-ecs-volume-plugin.socket create mode 100644 packaging/amazon-linux-ami-integrated/ecs-init.spec create mode 100755 packaging/amazon-linux-ami-integrated/ecs.conf create mode 100644 packaging/amazon-linux-ami-integrated/ecs.service diff --git a/Makefile b/Makefile index de05ebc7aa2..96ec6c18f9e 100644 --- a/Makefile +++ b/Makefile @@ -394,16 +394,23 @@ srpm: .srpm-done rpm: .rpm-done -ubuntu-trusty: - cp packaging/ubuntu-trusty/ecs.conf ecs.conf - tar -czf ./amazon-ecs-init_${VERSION}.orig.tar.gz ecs-init ecs.conf scripts README.md - mkdir -p BUILDROOT - cp -r packaging/ubuntu-trusty/debian BUILDROOT/debian - cp -r ecs-init BUILDROOT - cp packaging/ubuntu-trusty/ecs.conf BUILDROOT - cp -r scripts BUILDROOT - cp README.md BUILDROOT - cd BUILDROOT && debuild $(shell [ "$(DEB_SIGN)" -ne "0" ] || echo "-uc -us") +sources-with-agent.tgz: get-cni-sources + ./scripts/update-version.sh + cp packaging/amazon-linux-ami-integrated/ecs-init.spec ecs-init.spec + cp packaging/amazon-linux-ami-integrated/ecs.conf ecs.conf + cp packaging/amazon-linux-ami-integrated/ecs.service ecs.service + cp packaging/amazon-linux-ami-integrated/amazon-ecs-volume-plugin.conf amazon-ecs-volume-plugin.conf + cp packaging/amazon-linux-ami-integrated/amazon-ecs-volume-plugin.service amazon-ecs-volume-plugin.service + cp packaging/amazon-linux-ami-integrated/amazon-ecs-volume-plugin.socket amazon-ecs-volume-plugin.socket + tar -czf ./sources-with-agent.tgz ecs-init scripts agent amazon-ecs-cni-plugins amazon-vpc-cni-plugins misc agent-container VERSION + +.rpm-with-agent-done: sources-with-agent.tgz + test -e SOURCES || ln -s . SOURCES + rpmbuild --define "%_topdir $(PWD)" -bb ecs-init.spec + find RPMS/ -type f -exec cp {} . \; + touch .rpm-with-agent-done + +rpm-with-agent: .rpm-with-agent-done test-in-docker-init: docker build -f scripts/dockerfiles/test-init.dockerfile -t "amazon/amazon-ecs-init-test:make" . @@ -458,7 +465,7 @@ clean: -rm -f amazon-ecs-volume-plugin.service -rm -f amazon-ecs-volume-plugin.socket -rm -rf ./bin - -rm -f ./sources.tgz + -rm -f ./sources.tgz sources-with-agent.tgz -rm -f ./amazon-ecs-init -rm -f ./ecs-agent-*.tar -rm -f ./ecs-init-*.src.rpm @@ -466,7 +473,7 @@ clean: -rm -rf ./BUILDROOT BUILD RPMS SRPMS SOURCES SPECS -rm -rf ./x86_64 -rm -f ./amazon-ecs-init_${VERSION}* - -rm -f .srpm-done .rpm-done + -rm -f .srpm-done .rpm-done .rpm-with-agent-done -rm -rf coverprofile-init.out -rm -f misc/certs/host-certs.crt &> /dev/null -rm -rf misc/pause-container/image/ diff --git a/agent-container/agent-manifest.json b/agent-container/agent-manifest.json index 840d0392d65..f6b4f1f020f 100644 --- a/agent-container/agent-manifest.json +++ b/agent-container/agent-manifest.json @@ -1 +1 @@ -[{"Config":"config.json","RepoTags":["amazon/amazon-ecs-agent:~~agentversion~~"],"Layers":["rootfs/layer.tar"]}] +[{"Config":"config.json","RepoTags":["amazon/amazon-ecs-agent:~~agentversion~~", "amazon/amazon-ecs-agent:latest"],"Layers":["rootfs/layer.tar"]}] diff --git a/packaging/amazon-linux-ami-integrated/amazon-ecs-volume-plugin.conf b/packaging/amazon-linux-ami-integrated/amazon-ecs-volume-plugin.conf new file mode 100644 index 00000000000..3a19905ffc9 --- /dev/null +++ b/packaging/amazon-linux-ami-integrated/amazon-ecs-volume-plugin.conf @@ -0,0 +1,22 @@ +# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the +# "License"). You may not use this file except in compliance +# with the License. A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is +# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and +# limitations under the License. + +description "Amazon Elastic Container Service Volume Plugin" +author "Amazon Web Services" +start on stopped rc RUNLEVEL=[345] + +respawn +respawn limit 10 15 + +exec /usr/libexec/amazon-ecs-volume-plugin diff --git a/packaging/amazon-linux-ami-integrated/amazon-ecs-volume-plugin.service b/packaging/amazon-linux-ami-integrated/amazon-ecs-volume-plugin.service new file mode 100644 index 00000000000..10eb4743f37 --- /dev/null +++ b/packaging/amazon-linux-ami-integrated/amazon-ecs-volume-plugin.service @@ -0,0 +1,27 @@ +# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the +# "License"). You may not use this file except in compliance +# with the License. A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is +# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and +# limitations under the License + +[Unit] +Description=Amazon Elastic Container Service Volume Plugin +After=network.target amazon-ecs-volume-plugin.socket +Requires=amazon-ecs-volume-plugin.socket + +[Service] +Type=simple +Restart=on-failure +RestartSec=10s +ExecStart=/usr/libexec/amazon-ecs-volume-plugin + +[Install] +WantedBy=multi-user.target diff --git a/packaging/amazon-linux-ami-integrated/amazon-ecs-volume-plugin.socket b/packaging/amazon-linux-ami-integrated/amazon-ecs-volume-plugin.socket new file mode 100644 index 00000000000..c42342fea7f --- /dev/null +++ b/packaging/amazon-linux-ami-integrated/amazon-ecs-volume-plugin.socket @@ -0,0 +1,23 @@ +# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the +# "License"). You may not use this file except in compliance +# with the License. A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is +# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and +# limitations under the License + +[Unit] +Description=Amazon Elastic Container Service Volume Plugin +PartOf=amazon-ecs-volume-plugin.service + +[Socket] +ListenStream=/var/run/docker/plugins/amazon-ecs-volume-plugin.sock + +[Install] +WantedBy=sockets.target diff --git a/packaging/amazon-linux-ami-integrated/ecs-init.spec b/packaging/amazon-linux-ami-integrated/ecs-init.spec new file mode 100644 index 00000000000..3beb009acc2 --- /dev/null +++ b/packaging/amazon-linux-ami-integrated/ecs-init.spec @@ -0,0 +1,167 @@ +# Copyright 2014-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the +# "License"). You may not use this file except in compliance +# with the License. A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is +# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and +# limitations under the License. + +%bcond_with systemd # without +%global running_semaphore %{_localstatedir}/run/ecs-init.was-running + +%global _cachedir %{_localstatedir}/cache +%global no_exec_perm 644 +%global agent_image ecs-agent-v%{version}.tar + +Name: ecs-init +Version: 1.51.0 +Release: 1%{?dist} +License: Apache 2.0 +Summary: Amazon Elastic Container Service initialization application +# TODO: add back aarch64 +ExclusiveArch: x86_64 + +Source0: sources-with-agent.tgz +Source1: ecs.conf +Source2: ecs.service +Source3: amazon-ecs-volume-plugin.service +Source4: amazon-ecs-volume-plugin.socket +Source5: amazon-ecs-volume-plugin.conf + +BuildRequires: golang >= 1.7 +BuildRequires: glibc-static +%if %{with systemd} +BuildRequires: systemd +Requires: systemd +%else +Requires: upstart +%endif +Requires: iptables +Requires: docker >= 17.06.2ce +Requires: procps + +%description +ecs-init supports the initialization and supervision of the Amazon ECS +container agent, including configuration of cgroups, iptables, and +required routes among its preparation steps. + +%prep +%setup -c + +%build +./scripts/build-pause +./scripts/get-host-certs +./scripts/build-cni-plugins +./scripts/build true "" false true +./scripts/build-agent-image +./scripts/gobuild.sh + +%install +install -D amazon-ecs-init %{buildroot}%{_libexecdir}/amazon-ecs-init +install -D amazon-ecs-volume-plugin %{buildroot}%{_libexecdir}/amazon-ecs-volume-plugin +install -m %{no_exec_perm} -D scripts/amazon-ecs-init.1 %{buildroot}%{_mandir}/man1/amazon-ecs-init.1 + +mkdir -p %{buildroot}%{_sysconfdir}/ecs +touch %{buildroot}%{_sysconfdir}/ecs/ecs.config +touch %{buildroot}%{_sysconfdir}/ecs/ecs.config.json + +# Configure ecs-init to load the built ECS container agent image +mkdir -p %{buildroot}%{_cachedir}/ecs +echo 1 > %{buildroot}%{_cachedir}/ecs/state +install -m %{no_exec_perm} %{agent_image} %{buildroot}%{_cachedir}/ecs/ecs-agent.tar + +mkdir -p %{buildroot}%{_sharedstatedir}/ecs/data + +%if %{with systemd} +install -m %{no_exec_perm} -D %{SOURCE2} $RPM_BUILD_ROOT/%{_unitdir}/ecs.service +install -m %{no_exec_perm} -D %{SOURCE3} $RPM_BUILD_ROOT/%{_unitdir}/amazon-ecs-volume-plugin.service +install -m %{no_exec_perm} -D %{SOURCE4} $RPM_BUILD_ROOT/%{_unitdir}/amazon-ecs-volume-plugin.socket +%else +install -m %{no_exec_perm} -D %{SOURCE1} %{buildroot}%{_sysconfdir}/init/ecs.conf +install -m %{no_exec_perm} -D %{SOURCE5} %{buildroot}%{_sysconfdir}/init/amazon-ecs-volume-plugin.conf +%endif + +%files +%{_libexecdir}/amazon-ecs-init +%{_mandir}/man1/amazon-ecs-init.1* +%{_libexecdir}/amazon-ecs-volume-plugin +%config(noreplace) %ghost %{_sysconfdir}/ecs/ecs.config +%config(noreplace) %ghost %{_sysconfdir}/ecs/ecs.config.json +%{_cachedir}/ecs/ecs-agent.tar +%{_cachedir}/ecs/state +%dir %{_sharedstatedir}/ecs/data + +%if %{with systemd} +%{_unitdir}/ecs.service +%{_unitdir}/amazon-ecs-volume-plugin.service +%{_unitdir}/amazon-ecs-volume-plugin.socket +%else +%{_sysconfdir}/init/ecs.conf +%{_sysconfdir}/init/amazon-ecs-volume-plugin.conf +%endif + +%post +%if %{with systemd} +%systemd_post ecs +%systemd_post amazon-ecs-volume-plugin.service + +%postun +%systemd_postun +%systemd_postun_with_restart amazon-ecs-volume-plugin + +%else +%triggerun -- docker +# record whether or not our service was running when docker is upgraded +ecs_status=$(/sbin/status ecs 2>/dev/null || :) +if grep -qF "start/" <<< "${ecs_status}"; then + /sbin/stop ecs >/dev/null 2>&1 || : + if [ "$1" -ge 1 ]; then + # write semaphore if this package is still installed + touch %{running_semaphore} >/dev/null 2>&1 || : + fi +fi + +%triggerpostun -- docker +# ensures that ecs-init is restarted after docker or ecs-init is upgraded +if [ "$1" -ge 1 ] && [ -e %{running_semaphore} ]; then + /sbin/start ecs >/dev/null 2>&1 || : + rm %{running_semaphore} >/dev/null 2>&1 ||: +fi + +%postun +# record whether or not our service was running when ecs-init is upgraded +ecs_status=$(/sbin/status ecs 2>/dev/null || :) +if grep -qF "start/" <<< "${ecs_status}"; then + /sbin/stop ecs >/dev/null 2>&1 || : + if [ "$1" -ge 1 ]; then + # write semaphore if this package is upgraded + touch %{running_semaphore} >/dev/null 2>&1 || : + fi +fi +# remove semaphore if this package is erased +if [ "$1" -eq 0 ]; then + rm %{running_semaphore} >/dev/null 2>&1 || : +fi + +%triggerun -- ecs-init <= 1.0-3 +# handle old ecs-init package that does not properly stop +ecs_status=$(/sbin/status ecs 2>/dev/null || :) +if grep -qF "start/" <<< "${ecs_status}"; then + /sbin/stop ecs >/dev/null 2>&1 || : + touch %{running_semaphore} >/dev/null 2>&1 || : +fi + +%posttrans +# ensure that we restart after the transaction +if [ -e %{running_semaphore} ]; then + /sbin/start ecs >/dev/null 2>&1 || : + rm %{running_semaphore} >/dev/null 2>&1 || : +fi +%endif + diff --git a/packaging/amazon-linux-ami-integrated/ecs.conf b/packaging/amazon-linux-ami-integrated/ecs.conf new file mode 100755 index 00000000000..b8961951a02 --- /dev/null +++ b/packaging/amazon-linux-ami-integrated/ecs.conf @@ -0,0 +1,22 @@ +# Copyright 2014-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the +# "License"). You may not use this file except in compliance +# with the License. A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is +# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and +# limitations under the License. + +description "Amazon Elastic Container Service init" +author "Amazon Web Services" +start on stopped rc RUNLEVEL=[345] + +pre-start exec /usr/libexec/amazon-ecs-init pre-start +exec /usr/libexec/amazon-ecs-init start +pre-stop exec /usr/libexec/amazon-ecs-init pre-stop +post-stop exec /usr/libexec/amazon-ecs-init post-stop diff --git a/packaging/amazon-linux-ami-integrated/ecs.service b/packaging/amazon-linux-ami-integrated/ecs.service new file mode 100644 index 00000000000..c5aa3c3b7dc --- /dev/null +++ b/packaging/amazon-linux-ami-integrated/ecs.service @@ -0,0 +1,34 @@ +# Copyright 2014-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the +# "License"). You may not use this file except in compliance +# with the License. A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is +# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and +# limitations under the License. + +[Unit] +Description=Amazon Elastic Container Service - container agent +Documentation=https://aws.amazon.com/documentation/ecs/ +Requires=docker.service +After=docker.service +After=cloud-final.service + +[Service] +Type=simple +Restart=on-failure +RestartPreventExitStatus=5 +RestartSec=10s +EnvironmentFile=-/etc/ecs/ecs.config +ExecStartPre=/usr/libexec/amazon-ecs-init pre-start +ExecStart=/usr/libexec/amazon-ecs-init start +ExecStop=/usr/libexec/amazon-ecs-init stop +ExecStopPost=/usr/libexec/amazon-ecs-init post-stop + +[Install] +WantedBy=multi-user.target diff --git a/packaging/amazon-linux-ami/ecs-init.spec b/packaging/amazon-linux-ami/ecs-init.spec index 2d941b799b5..2ff24a85b77 100644 --- a/packaging/amazon-linux-ami/ecs-init.spec +++ b/packaging/amazon-linux-ami/ecs-init.spec @@ -49,6 +49,7 @@ Source5: amazon-ecs-volume-plugin.conf Source6: amazon-ecs-volume-plugin.service Source7: amazon-ecs-volume-plugin.socket +BuildRequires: golang >= 1.7 %if %{with systemd} BuildRequires: systemd Requires: systemd diff --git a/scripts/build b/scripts/build index be89a19532f..848f94e65a5 100755 --- a/scripts/build +++ b/scripts/build @@ -35,6 +35,15 @@ PAUSE_CONTAINER_TARBALL="amazon-ecs-pause.tar" ROOT=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd ) cd "${ROOT}" +export GO111MODULE="auto" +export BUILDDIR="$(mktemp -d)" +export GOPATH="${ROOT}/agent/:${BUILDDIR}" +export SRCPATH="${BUILDDIR}/src/github.com/aws/amazon-ecs-agent" + +mkdir -p "${SRCPATH}" +ln -s "${ROOT}/agent" "${SRCPATH}" +cd "${SRCPATH}/agent" + if [[ "${version_gen}" == "true" ]]; then # Versioning stuff. We run the generator to setup the version and then always # restore ourselves to a clean state @@ -67,3 +76,5 @@ fi if [[ -n "${output_directory}" ]]; then mv $build_exe "${output_directory}" fi + +rm -r "${BUILDDIR}" diff --git a/scripts/build-cni-plugins b/scripts/build-cni-plugins index b21160ffbd1..7725f137210 100755 --- a/scripts/build-cni-plugins +++ b/scripts/build-cni-plugins @@ -13,19 +13,25 @@ # permissions and limitations under the License. # this script builds the ecs/vpc cni plugins from the submodules -# by copying them out of agent into their expected location in the -# gopath - set -ex +# this script assumes we've run the get-cni-sources make target to update the cni submodules ROOT=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd ) cd "${ROOT}" -# copy submodules to expected go build path github.com/aws/amazon-ecs-cni-plugins -cp -r amazon-ecs-cni-plugins ../amazon-ecs-cni-plugins -cp -r amazon-vpc-cni-plugins ../amazon-vpc-cni-plugins -cd ../amazon-ecs-cni-plugins && GO111MODULE=auto make plugins -mkdir -p ../amazon-ecs-agent/misc/plugins && cp -a ./bin/plugins/. ../amazon-ecs-agent/misc/plugins/ + +export BUILDDIR="$(mktemp -d)" +export GITPATH="${BUILDDIR}/src/github.com/aws" +export GOPATH="${BUILDDIR}" + +mkdir -p "${GITPATH}" +ln -s "${ROOT}/amazon-ecs-cni-plugins" "${GITPATH}" +ln -s "${ROOT}/amazon-vpc-cni-plugins" "${GITPATH}" + +cd ${GITPATH}/amazon-ecs-cni-plugins && GO111MODULE=auto make plugins +mkdir -p ${ROOT}/misc/plugins && cp -a ./bin/plugins/. ${ROOT}/misc/plugins/ make clean -cd ../amazon-vpc-cni-plugins && GO111MODULE=auto make build -cp -a ./build/linux_amd64/. ../amazon-ecs-agent/misc/plugins/ +cd ${GITPATH}/amazon-vpc-cni-plugins && GO111MODULE=off BUILD_FLAGS="-tags disablekubeapi" make all-binaries +cp -a ./build/linux_amd64/. ${ROOT}/misc/plugins/ make clean + +rm -r "${BUILDDIR}"