diff --git a/.github/workflows/build-environment.yaml b/.github/workflows/build-environment.yaml index 57d5c71..3c7122e 100644 --- a/.github/workflows/build-environment.yaml +++ b/.github/workflows/build-environment.yaml @@ -22,65 +22,34 @@ jobs: build: runs-on: ubuntu-latest + strategy: + matrix: + dockerfile: + - build-radosgw + - build-run-radosgw + - build-run-radosgw-tests + steps: - name: Checkout uses: actions/checkout@v3 with: ref: ${{ inputs.ref }} - - name: Build build-radosgw image - id: build-radosgw-image + - name: Build image ${{ matrix.dockerfile }} + id: build-image uses: redhat-actions/buildah-build@v2 with: - image: s3gw/build-radosgw + image: 's3gw/${{ matrix.dockerfile }}' tags: latest ${{ github.sha }} - containerfiles: 'build/Dockerfile.build-radosgw' - context: 'build' + containerfiles: 'tools/build/Dockerfile.${{ matrix.dockerfile }}' + context: 'tools/build' - name: Push build-radosgw to quay.io - id: push-build-radosgw-to-quay - uses: redhat-actions/push-to-registry@v2 - with: - image: ${{ steps.build-radosgw-image.outputs.image }} - tags: ${{ steps.build-radosgw-image.outputs.tags }} - registry: quay.io - username: ${{ secrets.QUAY_USERNAME }} - password: ${{ secrets.QUAY_PASSWORD }} - - - name: Build run-radosgw image - id: run-radosgw-image - uses: redhat-actions/buildah-build@v2 - with: - image: s3gw/run-radosgw - tags: latest ${{ github.sha }} - containerfiles: 'build/Dockerfile.build-run-radosgw' - context: 'build' - - - name: Push run-radosgw to quay.io - id: push-run-radosgw-to-quay - uses: redhat-actions/push-to-registry@v2 - with: - image: ${{ steps.run-radosgw-image.outputs.image }} - tags: ${{ steps.run-radosgw-image.outputs.tags }} - registry: quay.io - username: ${{ secrets.QUAY_USERNAME }} - password: ${{ secrets.QUAY_PASSWORD }} - - - name: Build run-radosgw-tests image - id: run-radosgw-tests-image - uses: redhat-actions/buildah-build@v2 - with: - image: s3gw/run-radosgw-tests - tags: latest ${{ github.sha }} - containerfiles: 'build/Dockerfile.build-run-radosgw-tests' - context: 'build' - - - name: Push run-radosgw-tests to quay.io - id: push-run-radosgw-tests-to-quay + id: push-to-quay uses: redhat-actions/push-to-registry@v2 with: - image: ${{ steps.run-radosgw-tests-image.outputs.image }} - tags: ${{ steps.run-radosgw-tests-image.outputs.tags }} + image: ${{ steps.build-image.outputs.image }} + tags: ${{ steps.build-image.outputs.tags }} registry: quay.io username: ${{ secrets.QUAY_USERNAME }} password: ${{ secrets.QUAY_PASSWORD }} diff --git a/.gitmodules b/.gitmodules index 1806f4d..ad67059 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "k3s-ansible"] - path = env/playbooks/k3s-ansible + path = tools/env/playbooks/k3s-ansible url = https://github.com/k3s-io/k3s-ansible.git diff --git a/.markdownlint.jsonc b/.markdownlint.jsonc deleted file mode 100644 index 054b0b0..0000000 --- a/.markdownlint.jsonc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "MD024": { - "siblings_only": "true" - } -} diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 2727528..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,76 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [0.10.0] - unreleased - -### Added - -- RGW tests moved to ceph repository. -- build-radosgw.sh script changed to use build script from ceph repository. - -## [0.9.0] - 2022-12-01 - -### Added - -- Added `unittest_rgw_sfs_metadata_compatibility` and `unittest_rgw_sfs_gc` - unit tests for testing rgw/sfs. - -## [0.8.0] - 2022-11-10 - -### Added - -- added a script able to update the s3gw's deployment in kubernetes with the - radosgw binary built by the developer. - -### Changed - -- Expose `ETag` header in the Traefik s3gw ingress to allow multi-part - uploads via browser (gh#aquarist-labs/s3gw#170). -- Add the `OPTIONS` method to the Traefik CORS configuration (gh#aquarist-labs/s3gw#188). -- build containers based on openSUSE Leap 15.4 instead of Tumbleweed. -- radosgw binaries have been moved to /radosgw directory in gateway's Dockerfiles. - -## [0.7.0] - 2022-10-20 - -### Added - -- added multipart upload tests. -- rearranged python test names to follow a `test-*.py` convention. -- created top-script to run smoke tests and python tests. - -### Changed - -- libfmt system package updated to version 9 in gateway's Dockerfiles. - -## [0.6.0] - 2022-09-29 - -- added '--longhorn-custom-settings' option to env/setup.sh to install longhorn - using custom settings. -- added the ability to build a s3gw-test image able to run google-tests related to - radosgw sfs backend development. - -## [0.4.0] - 2022-09-01 - -### Added - -- added '--no-s3gw' option to env/setup.sh to install K3s only. -- added '--import-local-image' and '--import-local-ui-image' options to -- added `tests/s3gw-buckets-rest-api-test.py` to test bucket related rest calls. - -### Changed - -- relocate docs to [s3gw repository](https://github.com/aquarist-labs/s3gw/docs). - import local s3gw and s3gw-ui images into a running K3s. -- Boost system packages updated to version 80_0 in gateway's Dockerfiles. - -## [0.3.0] - 2022-08-04 - -## [0.2.0] - 2022-07-28 - -## [0.1.0] - 2022-07-14 - -- Initial release. diff --git a/LICENSE b/LICENSE deleted file mode 100644 index d645695..0000000 --- a/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - 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. diff --git a/README.md b/README.md deleted file mode 100644 index c88efc1..0000000 --- a/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# s3gw-tools - -[![License][license-badge]][license-url] -[![Lint][lint-badge]][lint-url] -[![Build][build-badge]][lint-url] - -Build tools for [s3gw][s3gw] - -s3gw is an S3-compatible service focused on deployments in a Kubernetes -environment backed by any PVC, including Longhorn. Since its inception, the -primary focus has been on cloud native deployments. However, the s3gw can be -deployed in a myriad of scenarios, provided some form of storage is attached. - -s3gw is based on Ceph’s RADOSGW (RGW) but runs as a stand–alone service without -the RADOS cluster and relies on a storage backend still under heavy development -by the storage team at SUSE. A web-based UI for management and an object -explorer are also part of s3gw. - -- [Developing][developing] -- [Documentation][documentation]. - -## License - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use licensed files except in compliance with the License. -You may obtain a copy of the License at - - - -or the LICENSE file in this repository. - -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. - -[s3gw]: https://github.com/aquarist-labs/s3gw-charts -[documentation]: https://s3gw-docs.readthedocs.io/en/latest/ -[developing]: https://s3gw-docs.readthedocs.io/en/latest/developing/ -[license-badge]: https://img.shields.io/github/license/aquarist-labs/s3gw -[license-url]: https://s3gw-docs.readthedocs.io/en/latest/license/ -[lint-badge]: https://img.shields.io/github/actions/workflow/status/aquarist-labs/s3gw-tools/lint.yaml?branch=main&label=lint -[lint-url]: https://github.com/aquarist-labs/s3gw-tools/actions/workflows/lint.yaml -[build-badge]: https://img.shields.io/github/actions/workflow/status/aquarist-labs/s3gw-tools/build-environment.yaml?branch=main -[build-url]: https://github.com/aquarist-labs/s3gw-tools/actions/workflows/build-environment.yaml diff --git a/.s3cfg b/tools/.s3cfg similarity index 100% rename from .s3cfg rename to tools/.s3cfg diff --git a/build-ui/Dockerfile.app b/tools/build-ui/Dockerfile.app similarity index 100% rename from build-ui/Dockerfile.app rename to tools/build-ui/Dockerfile.app diff --git a/build-ui/Dockerfile.app-builder b/tools/build-ui/Dockerfile.app-builder similarity index 100% rename from build-ui/Dockerfile.app-builder rename to tools/build-ui/Dockerfile.app-builder diff --git a/build-ui/build-app.sh b/tools/build-ui/build-app.sh similarity index 100% rename from build-ui/build-app.sh rename to tools/build-ui/build-app.sh diff --git a/build-ui/build.sh b/tools/build-ui/build.sh similarity index 100% rename from build-ui/build.sh rename to tools/build-ui/build.sh diff --git a/build/Dockerfile.build-container b/tools/build/Dockerfile.build-container similarity index 100% rename from build/Dockerfile.build-container rename to tools/build/Dockerfile.build-container diff --git a/build/Dockerfile.build-radosgw b/tools/build/Dockerfile.build-radosgw similarity index 100% rename from build/Dockerfile.build-radosgw rename to tools/build/Dockerfile.build-radosgw diff --git a/build/Dockerfile.build-radosgw-test-container b/tools/build/Dockerfile.build-radosgw-test-container similarity index 100% rename from build/Dockerfile.build-radosgw-test-container rename to tools/build/Dockerfile.build-radosgw-test-container diff --git a/build/Dockerfile.build-run-radosgw b/tools/build/Dockerfile.build-run-radosgw similarity index 100% rename from build/Dockerfile.build-run-radosgw rename to tools/build/Dockerfile.build-run-radosgw diff --git a/build/Dockerfile.build-run-radosgw-tests b/tools/build/Dockerfile.build-run-radosgw-tests similarity index 100% rename from build/Dockerfile.build-run-radosgw-tests rename to tools/build/Dockerfile.build-run-radosgw-tests diff --git a/tools/build/Dockerfile.s3gw b/tools/build/Dockerfile.s3gw new file mode 100644 index 0000000..4a4a076 --- /dev/null +++ b/tools/build/Dockerfile.s3gw @@ -0,0 +1,171 @@ +FROM opensuse/leap:15.4 as runtime + +# Add OBS repository for additional dependencies necessary on Leap 15.4 +RUN zypper ar \ + https://download.opensuse.org/repositories/filesystems:/ceph:/s3gw/15.4/ \ + s3gw-deps \ + && zypper --gpg-auto-import-keys ref +RUN zypper -n install \ + libblkid1 \ + libexpat1 \ + libtcmalloc4 \ + libfmt9 \ + liboath0 \ + libicu-suse65_1 \ + libthrift-0_16_0 \ + libboost_atomic1_80_0 \ + libboost_chrono1_80_0 \ + libboost_context1_80_0 \ + libboost_coroutine1_80_0 \ + libboost_date_time1_80_0 \ + libboost_filesystem1_80_0 \ + libboost_iostreams1_80_0 \ + libboost_program_options1_80_0 \ + libboost_random1_80_0 \ + libboost_regex1_80_0 \ + libboost_serialization1_80_0 \ + libboost_system1_80_0 \ + libboost_thread1_80_0 \ + && zypper clean --all \ + && mkdir -p /radosgw /data + +ENV PATH /radosgw:$PATH +ENV LD_LIBRARY_PATH /radosgw:$LD_LIBRARY_PATH + +FROM opensuse/leap:15.4 AS buildenv + +ARG CMAKE_BUILD_TYPE=Release +ENV CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + +# Add OBS repository for additional dependencies necessary on Leap 15.4 +RUN zypper ar \ + https://download.opensuse.org/repositories/filesystems:/ceph:/s3gw/15.4/ \ + s3gw-deps \ + && zypper --gpg-auto-import-keys ref +RUN zypper -n install --no-recommends \ + 'cmake>3.5' \ + 'fmt-devel>=6.2.1' \ + 'gperftools-devel>=2.4' \ + 'libblkid-devel>=2.17' \ + 'liblz4-devel>=1.7' \ + 'libthrift-devel>=0.13.0' \ + 'pkgconfig(libudev)' \ + 'pkgconfig(systemd)' \ + 'pkgconfig(udev)' \ + babeltrace-devel \ + binutils \ + ccache \ + cmake \ + cpp11 \ + cryptsetup-devel \ + cunit-devel \ + fdupes \ + fuse-devel \ + gcc-c++ \ + gcc11 \ + gcc11-c++ \ + git \ + gperf \ + jq \ + keyutils-devel \ + libaio-devel \ + libasan6 \ + libboost_atomic1_80_0-devel \ + libboost_context1_80_0-devel \ + libboost_coroutine1_80_0-devel \ + libboost_filesystem1_80_0-devel \ + libboost_iostreams1_80_0-devel \ + libboost_program_options1_80_0-devel \ + libboost_python-py3-1_80_0-devel \ + libboost_random1_80_0-devel \ + libboost_regex1_80_0-devel \ + libboost_system1_80_0-devel \ + libboost_thread1_80_0-devel \ + libbz2-devel \ + libcap-ng-devel \ + libcurl-devel \ + libexpat-devel \ + libicu-devel \ + libnl3-devel \ + liboath-devel \ + libopenssl-devel \ + libpmem-devel \ + libpmemobj-devel \ + librabbitmq-devel \ + librdkafka-devel \ + libsqliteorm \ + libstdc++6-devel-gcc11 \ + libtool \ + libtsan0 \ + libxml2-devel \ + lttng-ust-devel \ + lua-devel \ + lua53-luarocks \ + make \ + memory-constraints \ + mozilla-nss-devel \ + nasm \ + ncurses-devel \ + net-tools \ + ninja \ + ninja \ + openldap2-devel \ + patch \ + perl \ + pkgconfig \ + procps \ + python3 \ + python3-Cython \ + python3-PrettyTable \ + python3-PyYAML \ + python3-Sphinx \ + python3-devel \ + python3-setuptools \ + rdma-core-devel \ + re2-devel \ + rpm-build \ + snappy-devel \ + sqlite-devel \ + systemd-rpm-macros \ + systemd-rpm-macros \ + valgrind-devel \ + xfsprogs-devel \ + xmlstarlet \ + && zypper clean --all + +COPY . /srv + +RUN /srv/ceph/qa/rgw/store/sfs/build-radosgw.sh + +FROM runtime AS s3gw +LABEL Name=s3gw + +ARG ID=s3gw +ENV ID=${ID} + +COPY --from=buildenv /srv/ceph/build/bin/radosgw /radosgw/ +COPY --from=buildenv \ + [ "/srv/ceph/build/lib/libradosgw.so", \ + "/srv/ceph/build/lib/libradosgw.so.2", \ + "/srv/ceph/build/lib/libradosgw.so.2.0.0", \ + "/srv/ceph/build/lib/librados.so", \ + "/srv/ceph/build/lib/librados.so.2", \ + "/srv/ceph/build/lib/librados.so.2.0.0", \ + "/srv/ceph/build/lib/libceph-common.so", \ + "/srv/ceph/build/lib/libceph-common.so.2", \ + "/radosgw/" ] + +# HTTP + HTTPS +EXPOSE 7480 +EXPOSE 7481 + +VOLUME ["/data"] +ENTRYPOINT ["radosgw", \ + "-d", \ + "--no-mon-config", \ + "--id", "${ID}", \ + "--rgw-data", "/data/", \ + "--run-dir", "/run/", \ + "--rgw-sfs-data-path", "/data"] +CMD ["--rgw-backend-store", "sfs", \ + "--debug-rgw", "1"] diff --git a/build/build-container.sh b/tools/build/build-container.sh similarity index 100% rename from build/build-container.sh rename to tools/build/build-container.sh diff --git a/build/build-radosgw-test-container.sh b/tools/build/build-radosgw-test-container.sh similarity index 100% rename from build/build-radosgw-test-container.sh rename to tools/build/build-radosgw-test-container.sh diff --git a/build/build-radosgw.sh b/tools/build/build-radosgw.sh similarity index 100% rename from build/build-radosgw.sh rename to tools/build/build-radosgw.sh diff --git a/build/build.sh b/tools/build/build.sh similarity index 100% rename from build/build.sh rename to tools/build/build.sh diff --git a/build/run_tests.sh b/tools/build/run_tests.sh similarity index 100% rename from build/run_tests.sh rename to tools/build/run_tests.sh diff --git a/env/.gitignore b/tools/env/.gitignore similarity index 100% rename from env/.gitignore rename to tools/env/.gitignore diff --git a/env/Vagrantfile b/tools/env/Vagrantfile similarity index 100% rename from env/Vagrantfile rename to tools/env/Vagrantfile diff --git a/env/ansible.cfg b/tools/env/ansible.cfg similarity index 100% rename from env/ansible.cfg rename to tools/env/ansible.cfg diff --git a/env/generate-spec.sh b/tools/env/generate-spec.sh similarity index 100% rename from env/generate-spec.sh rename to tools/env/generate-spec.sh diff --git a/env/ingress-traefik/longhorn-ingress.yaml b/tools/env/ingress-traefik/longhorn-ingress.yaml similarity index 100% rename from env/ingress-traefik/longhorn-ingress.yaml rename to tools/env/ingress-traefik/longhorn-ingress.yaml diff --git a/env/ingress-traefik/s3gw-ingress.yaml b/tools/env/ingress-traefik/s3gw-ingress.yaml similarity index 100% rename from env/ingress-traefik/s3gw-ingress.yaml rename to tools/env/ingress-traefik/s3gw-ingress.yaml diff --git a/env/ingress-traefik/s3gw-ui-ingress.yaml b/tools/env/ingress-traefik/s3gw-ui-ingress.yaml similarity index 100% rename from env/ingress-traefik/s3gw-ui-ingress.yaml rename to tools/env/ingress-traefik/s3gw-ui-ingress.yaml diff --git a/env/ingress-traefik/traefik-nodeport.yaml b/tools/env/ingress-traefik/traefik-nodeport.yaml similarity index 100% rename from env/ingress-traefik/traefik-nodeport.yaml rename to tools/env/ingress-traefik/traefik-nodeport.yaml diff --git a/env/longhorn-setting.yaml.sample b/tools/env/longhorn-setting.yaml.sample similarity index 100% rename from env/longhorn-setting.yaml.sample rename to tools/env/longhorn-setting.yaml.sample diff --git a/env/longhorn/longhorn-ingress-secret.yaml b/tools/env/longhorn/longhorn-ingress-secret.yaml similarity index 100% rename from env/longhorn/longhorn-ingress-secret.yaml rename to tools/env/longhorn/longhorn-ingress-secret.yaml diff --git a/env/longhorn/longhorn-s3gw-secret.yaml b/tools/env/longhorn/longhorn-s3gw-secret.yaml similarity index 100% rename from env/longhorn/longhorn-s3gw-secret.yaml rename to tools/env/longhorn/longhorn-s3gw-secret.yaml diff --git a/env/longhorn/longhorn-storageclass.yaml b/tools/env/longhorn/longhorn-storageclass.yaml similarity index 100% rename from env/longhorn/longhorn-storageclass.yaml rename to tools/env/longhorn/longhorn-storageclass.yaml diff --git a/env/playbooks/bootstrap.yaml b/tools/env/playbooks/bootstrap.yaml similarity index 100% rename from env/playbooks/bootstrap.yaml rename to tools/env/playbooks/bootstrap.yaml diff --git a/env/playbooks/ingress-traefik-deploy.yaml b/tools/env/playbooks/ingress-traefik-deploy.yaml similarity index 100% rename from env/playbooks/ingress-traefik-deploy.yaml rename to tools/env/playbooks/ingress-traefik-deploy.yaml diff --git a/env/playbooks/k3s-post-install.yaml b/tools/env/playbooks/k3s-post-install.yaml similarity index 100% rename from env/playbooks/k3s-post-install.yaml rename to tools/env/playbooks/k3s-post-install.yaml diff --git a/env/playbooks/load-scen.yaml b/tools/env/playbooks/load-scen.yaml similarity index 100% rename from env/playbooks/load-scen.yaml rename to tools/env/playbooks/load-scen.yaml diff --git a/env/playbooks/longhorn-deploy.yaml b/tools/env/playbooks/longhorn-deploy.yaml similarity index 100% rename from env/playbooks/longhorn-deploy.yaml rename to tools/env/playbooks/longhorn-deploy.yaml diff --git a/env/playbooks/s3gw-deploy.yaml b/tools/env/playbooks/s3gw-deploy.yaml similarity index 100% rename from env/playbooks/s3gw-deploy.yaml rename to tools/env/playbooks/s3gw-deploy.yaml diff --git a/env/playbooks/s3gw-ui-deploy.yaml b/tools/env/playbooks/s3gw-ui-deploy.yaml similarity index 100% rename from env/playbooks/s3gw-ui-deploy.yaml rename to tools/env/playbooks/s3gw-ui-deploy.yaml diff --git a/env/s3cmd.cfg b/tools/env/s3cmd.cfg similarity index 100% rename from env/s3cmd.cfg rename to tools/env/s3cmd.cfg diff --git a/env/s3gw-dev.yaml b/tools/env/s3gw-dev.yaml similarity index 100% rename from env/s3gw-dev.yaml rename to tools/env/s3gw-dev.yaml diff --git a/env/s3gw-ui/s3gw-ui-deployment.yaml b/tools/env/s3gw-ui/s3gw-ui-deployment.yaml similarity index 100% rename from env/s3gw-ui/s3gw-ui-deployment.yaml rename to tools/env/s3gw-ui/s3gw-ui-deployment.yaml diff --git a/env/s3gw-ui/s3gw-ui-service.yaml b/tools/env/s3gw-ui/s3gw-ui-service.yaml similarity index 100% rename from env/s3gw-ui/s3gw-ui-service.yaml rename to tools/env/s3gw-ui/s3gw-ui-service.yaml diff --git a/env/s3gw.yaml b/tools/env/s3gw.yaml similarity index 100% rename from env/s3gw.yaml rename to tools/env/s3gw.yaml diff --git a/env/s3gw/s3gw-config.yaml b/tools/env/s3gw/s3gw-config.yaml similarity index 100% rename from env/s3gw/s3gw-config.yaml rename to tools/env/s3gw/s3gw-config.yaml diff --git a/env/s3gw/s3gw-deployment.yaml b/tools/env/s3gw/s3gw-deployment.yaml similarity index 100% rename from env/s3gw/s3gw-deployment.yaml rename to tools/env/s3gw/s3gw-deployment.yaml diff --git a/env/s3gw/s3gw-ingress-secret.yaml b/tools/env/s3gw/s3gw-ingress-secret.yaml similarity index 100% rename from env/s3gw/s3gw-ingress-secret.yaml rename to tools/env/s3gw/s3gw-ingress-secret.yaml diff --git a/env/s3gw/s3gw-namespace.yaml b/tools/env/s3gw/s3gw-namespace.yaml similarity index 100% rename from env/s3gw/s3gw-namespace.yaml rename to tools/env/s3gw/s3gw-namespace.yaml diff --git a/env/s3gw/s3gw-pvc.yaml b/tools/env/s3gw/s3gw-pvc.yaml similarity index 100% rename from env/s3gw/s3gw-pvc.yaml rename to tools/env/s3gw/s3gw-pvc.yaml diff --git a/env/s3gw/s3gw-secret.yaml b/tools/env/s3gw/s3gw-secret.yaml similarity index 100% rename from env/s3gw/s3gw-secret.yaml rename to tools/env/s3gw/s3gw-secret.yaml diff --git a/env/s3gw/s3gw-service.yaml b/tools/env/s3gw/s3gw-service.yaml similarity index 100% rename from env/s3gw/s3gw-service.yaml rename to tools/env/s3gw/s3gw-service.yaml diff --git a/env/scenarios/default/load-scen.sh b/tools/env/scenarios/default/load-scen.sh similarity index 100% rename from env/scenarios/default/load-scen.sh rename to tools/env/scenarios/default/load-scen.sh diff --git a/env/setup-vm.sh b/tools/env/setup-vm.sh similarity index 100% rename from env/setup-vm.sh rename to tools/env/setup-vm.sh diff --git a/env/setup.sh b/tools/env/setup.sh similarity index 100% rename from env/setup.sh rename to tools/env/setup.sh diff --git a/scripts/patch-s3gw-deployment.sh b/tools/scripts/patch-s3gw-deployment.sh similarity index 100% rename from scripts/patch-s3gw-deployment.sh rename to tools/scripts/patch-s3gw-deployment.sh diff --git a/tests/create-s3tests-report.sh b/tools/tests/create-s3tests-report.sh similarity index 100% rename from tests/create-s3tests-report.sh rename to tools/tests/create-s3tests-report.sh diff --git a/tests/s3gw-smoke-test.sh b/tools/tests/s3gw-smoke-test.sh similarity index 100% rename from tests/s3gw-smoke-test.sh rename to tools/tests/s3gw-smoke-test.sh diff --git a/tests/s3gw-test.sh b/tools/tests/s3gw-test.sh similarity index 100% rename from tests/s3gw-test.sh rename to tools/tests/s3gw-test.sh diff --git a/tools/tests/s3tests-runner.sh b/tools/tests/s3tests-runner.sh new file mode 100755 index 0000000..b5d3fb1 --- /dev/null +++ b/tools/tests/s3tests-runner.sh @@ -0,0 +1,130 @@ +#!/bin/bash + +set -e + +CEPH_DIR=${CEPH_DIR:-"/srv/ceph"} +S3GW_CONTAINER=${S3GW_CONTAINER:-"quay.io/s3gw/s3gw:latest"} + +OUTPUT_DIR=${OUTPUT_DIR:-"$(pwd)/s3tests.results"} +OUTPUT_FILE=${OUTPUT_FILE:-"${OUTPUT_DIR}/report.json"} + +S3TEST_REPO=${S3TEST_REPO:-"$(pwd)"} +S3TEST_CONF=${S3TEST_CONF:-"${CEPH_DIR}/qa/rgw/store/sfs/tests/fixtures/s3tests.conf"} +S3TEST_LIST=${S3TEST_LIST:-"${CEPH_DIR}/qa/rgw/store/sfs/tests/fixtures/s3-tests.txt"} + +CONTAINER= +FORCE_CONTAINER=${FORCE_CONTAINER:-"OFF"} +JOB= +TMPFILE= +TMPDIR= + + +_setup() { + local test="$1" + + mkdir -p "${OUTPUT_DIR}/logs/${test}" + + if [ ! -d "${CEPH_DIR}/build/bin" ] ; then + echo "Using s3gw container" + CONTAINER=$(podman run --rm -d -p 7480:7480 quay.io/s3gw/s3gw:latest) + elif ! grep -q -i suse /etc/os-release || [ "${FORCE_CONTAINER}" = "ON" ] ; then + echo "Using runtime container" + CONTAINER=$(podman run \ + --rm \ + -d \ + -p 7480:7480 \ + -v "${CEPH_DIR}/build/bin":"/radosgw/bin" \ + -v "${CEPH_DIR}/build/lib":"/radosgw/lib" \ + quay.io/s3gw/run-radosgw:latest + ) + else + echo "Using host runtime" + TMPDIR=$(mktemp -q -d -p "${OUTPUT_DIR}" data.XXXXXX.dir) + mkdir -p "${TMPDIR}/data" "${TMPDIR}/run" + + "${CEPH_DIR}/build/bin/radosgw" \ + -d \ + --no-mon-config \ + --id s3gw \ + --rgw-data "${TMPDIR}/data" \ + --run-dir "${TMPDIR}/run" \ + --rgw-sfs-data-path "${TMPDIR}/data" \ + --rgw-backend-store sfs \ + --debug-rgw 1 \ + > "${OUTPUT_DIR}/logs/${test}/radosgw.log" 2>&1 & + JOB="$!" + + # sleep until s3gw has spun up + while ! curl -s localhost:7480 > /dev/null ; do sleep .1 ; done + fi + + pushd "${S3TEST_REPO}" > /dev/null || exit 1 +} + + +_run() { + local test="$1" + local result= + local name ; name="$(echo "$test" | cut -d ':' -f 2)" + + _setup "$test" + + # this is needed for nosetests + export S3TEST_CONF + if nosetests \ + -c "${S3TEST_CONF}" \ + -s \ + -a '!fails_on_rgw,!lifecycle_expiration,!fails_strict_rfc2616' \ + "$test" > "${OUTPUT_DIR}/logs/${test}/test.output" 2>&1 ; then + result="success" + else + result="failure" + fi + + echo "$test : $result" + + yq -i \ + ".tests += [{\"name\": \"${name}\", \"result\": \"${result}\"}]" \ + "${TMPFILE}" + _teardown +} + + +_teardown() { + if [ -n "$CONTAINER" ] ; then + podman kill "$CONTAINER" + else + kill "$JOB" + rm -rf "${TMPDIR}" + fi + + popd > /dev/null || exit 1 +} + + +_convert() { + yq -o=json '.' "${TMPFILE}" > "${OUTPUT_FILE}" + rm "${TMPFILE}" +} + + +_main() { + [ -d "${OUTPUT_DIR}" ] || mkdir -p "${OUTPUT_DIR}" + [ -d "${OUTPUT_DIR}/logs" ] || mkdir -p "${OUTPUT_DIR}/logs" + + TMPFILE="$(mktemp -q -p "${OUTPUT_DIR}" report.XXXXXX.ymal)" + [ -f "${TMPFILE}" ] || echo "tests:" > "${TMPFILE}" + + if [ -n "$1" ] ; then + _run "$1" + else + while read -r test ; do + _run "$test" + done < <( grep -v '#' "$S3TEST_LIST" ) + fi + + _convert +} + + +_main "$@" diff --git a/tests/test-s3gw-buckets-rest-api.py b/tools/tests/test-s3gw-buckets-rest-api.py similarity index 100% rename from tests/test-s3gw-buckets-rest-api.py rename to tools/tests/test-s3gw-buckets-rest-api.py diff --git a/tests/test-s3gw-multipart.py b/tools/tests/test-s3gw-multipart.py similarity index 100% rename from tests/test-s3gw-multipart.py rename to tools/tests/test-s3gw-multipart.py diff --git a/tests/test-s3gw-users-rest-api.py b/tools/tests/test-s3gw-users-rest-api.py similarity index 100% rename from tests/test-s3gw-users-rest-api.py rename to tools/tests/test-s3gw-users-rest-api.py diff --git a/tests/test-s3gw-versioning-smoke.py b/tools/tests/test-s3gw-versioning-smoke.py similarity index 100% rename from tests/test-s3gw-versioning-smoke.py rename to tools/tests/test-s3gw-versioning-smoke.py