Home

Awesome

refinery-submodule-s3

refinery repository

S3 related AWS and Minio logic.

Caution! This is only meant as a submodule not as a library

If you like what we're working on, please leave a ⭐ for refinery!

Usage

Implement by using: git submodule add https://github.com/code-kern-ai/refinery-submodule-s3.git submodules/s3

This means the requirements of the project need to include:

boto3
minio

Also some os variables are required to access minio:

Also some os variables are required to access aws:

They are stored in a different set of os variables to be able to migration from minio to aws

Common submodule logic applies

git submodules

Submodules can be a bit irritating - key insights:

  1. Paths need to be relative inside the module (e.g. from . import constants )
  2. They are their own repositories so they need to be handled as such (committing etc. for changes inside their own branch)
  3. Cloning needs to be done recursively to get the files
  4. Adding submodules without changing the folder will result in errors because the import of paths with - doesn't work
  5. Drone builds appear to work fine
  6. Drone builds need to include the "collection" of the submodules data so another step needs to be introduces to the .yml file:
- name: submodules
  image: alpine/git
  commands:
    - git submodule init
    - 'git config --global url."https://github.com/".insteadOf git@github.com:'
    - "git submodule update --recursive"

"remember" to pull / push for the submodules!!

Example Commands for submodules

Clone reposity with submodules

git clone <git@github ...> --recursive Example git clone git@github.com:code-kern-ai/refinery-gateway.git --recursive

(if you missed the --recursive part or switch to a branch with a new submodule): git submodule update --init

Add submodule

(no path specified -> the repository will be a new folder on the top level - DON'T DO THIS)

git submodule add <git@github ...> snipmate-snippets/snippets/

(path specified -> this one we usually want since repository names might have some issues)

git submodule add <git@github ...> submodules/<repo_name_with_underscores>

Working with submodules after initial setup