Skip to content

Commit

Permalink
Initial configuration loading
Browse files Browse the repository at this point in the history
  • Loading branch information
faermanj committed Nov 14, 2023
1 parent 3385fd2 commit d523f7a
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 24 deletions.
27 changes: 17 additions & 10 deletions up_splat/Containerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# docker build --no-cache --progress=plain -t caravanacloud/$(basename $PWD) -f Containerfile .
FROM registry.fedoraproject.org/fedora:38

# Oracle Cloud CLI
FROM registry.fedoraproject.org/fedora:38

# System Updates
RUN bash -c "sudo dnf -y update"
RUN bash -c "sudo dnf -y install unzip zip pipx wget nodejs python3 python3-pip"
RUN bash -c "python3 -m pip install --no-cache-dir oci-cli"


# Java and Quarkus
ARG JAVA_SDK="21-graalce"
Expand Down Expand Up @@ -110,15 +111,15 @@ RUN bash -c "curl 'https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip' -o
&& aws --version \
"

RUN bash -c "npm install -g aws-cdk"
# RUN bash -c "npm install -g aws-cdk"

ARG SAM_URL="https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip"
RUN bash -c "curl -Ls '${SAM_URL}' -o '/tmp/aws-sam-cli-linux-x86_64.zip' \
&& unzip '/tmp/aws-sam-cli-linux-x86_64.zip' -d '/tmp/sam-installation' \
&& sudo '/tmp/sam-installation/install' \
&& sam --version"
# ARG SAM_URL="https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip"
# RUN bash -c "curl -Ls '${SAM_URL}' -o '/tmp/aws-sam-cli-linux-x86_64.zip' \
# && unzip '/tmp/aws-sam-cli-linux-x86_64.zip' -d '/tmp/sam-installation' \
# && sudo '/tmp/sam-installation/install' \
# && sam --version"

RUN bash -c "pip install cloudformation-cli cloudformation-cli-java-plugin cloudformation-cli-go-plugin cloudformation-cli-python-plugin cloudformation-cli-typescript-plugin"
# RUN bash -c "pip install cloudformation-cli cloudformation-cli-java-plugin cloudformation-cli-go-plugin cloudformation-cli-python-plugin cloudformation-cli-typescript-plugin"

# Azure CLI
# RUN bash -c "curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash"
Expand All @@ -134,6 +135,12 @@ RUN bash -c "curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/
&& sudo ln -s /workspace/red-pod/google-cloud-sdk/bin/gcloud /usr/local/bin/gcloud \
"

# Oracle Cloud CLI
RUN bash -c "python3 -m pip install --no-cache-dir oci-cli"

# COPY
COPY . /opt/workspace
RUN bash -c "find /opt/workspace"

# Done :)
RUN bash -c "echo 'done.'"
Expand Down
4 changes: 4 additions & 0 deletions up_splat/up_splat/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
from uplib import pm
from up_splat import containers_for_prompt

print("Loading up_splat...")
pm.register(containers_for_prompt)

print("Loaded up_splat.")

5 changes: 5 additions & 0 deletions up_splat/up_splat/splat/create/cluster/oci-standard/main.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

echo "Creating OCI Standard Cluster"
sleep 5
echo "Done"
9 changes: 9 additions & 0 deletions up_splat/up_splat/splat/create/cluster/oci-standard/up.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# TODO: Find and parse all yaml
env:
- OCI_CLI_REGION
- PARENT_COMPARTMENT_ID
- TENANCY_ID
- TENANCY_COMPARTMENT_ID
- ZONE_ID
- AI_OFFLINETOKEN
- PULL_SECRET
1 change: 1 addition & 0 deletions up_splat/up_splat/up.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# here goes some yaml
21 changes: 10 additions & 11 deletions uplib/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 16 additions & 3 deletions uplib/uplib/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,27 @@ def load_plugins(context):
log.info("Loading plugins")
discovered_plugins = {
name: importlib.import_module(name)
for finder, name, ispkg
in pkgutil.iter_modules()
if name.startswith('up_')
for finder, name, ispkg
in pkgutil.iter_modules()
if name.startswith('up_')
}
# for each plugin, seach its contents for all configuration files named up.yaml
plugin_names = discovered_plugins.keys()
for plugin_name in plugin_names:
load_plugin(plugin_name)
log.info("Discovered %s plugins: %s", len(plugin_names), str(plugin_names))
# create a manager and add the spec
# pm.load_setuptools_entrypoints("up")
# pm.add_hookspecs(hookspec)
# log.debug("Plugins loaded.")
# log.debug(str(pm.get_plugins()))

def load_plugin(plugin_name):
log.info("Loading plugin %s", plugin_name)
try:
cfg = pkgutil.get_data(plugin_name, "up.yaml")
except FileNotFoundError:
log.info("No up.yaml found in plugin %s", plugin_name)
cfg = None
if cfg:
print(str(cfg))

0 comments on commit d523f7a

Please sign in to comment.