Skip to content

Commit

Permalink
WIP deploy tasks, merge with main
Browse files Browse the repository at this point in the history
  • Loading branch information
justinthelaw committed Oct 3, 2024
1 parent 3ce634e commit 6068be7
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 104 deletions.
3 changes: 1 addition & 2 deletions tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ includes:
###########################
- badge: ./tasks/badge.yaml
- create: ./tasks/create.yaml
- publish: ./tasks/publish.yaml
- publish: ./tasks/utils.yaml
- setup: ./tasks/setup.yaml
- deploy: ./tasks/deploy.yaml
- utils: ./tasks/utils.yaml

tasks:
#######
Expand Down
52 changes: 27 additions & 25 deletions tasks/create.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ includes:
###########################
# LEAPFROGAI-SPECIFIC TASKS
###########################
- publish: ./publish.yaml
- utils: ./utils.yaml

tasks:
#########
Expand All @@ -35,8 +35,9 @@ tasks:
cmd: |
if [[ ${FLAVOR} != "upstream" || ${{ .inputs.override }} != "false" ]]; then
if [ ! "$(docker ps -q -f name=${{ .inputs.name }})" ]; then
docker run -d -p ${{ .inputs.port }}:5000 --restart=always -q --name ${{ .inputs.name }} registry:2
docker run -d -p ${{ .inputs.port }}:5000 --restart=always -q --name ${{ .inputs.name }} registry:2 > /dev/null 2>&1
echo "false"
fi
else
echo "true"
fi
Expand All @@ -45,7 +46,7 @@ tasks:
- name: ENABLE_LOG
- task: utils:log
with:
log: "Non-upstream flavor detected, skipping local image build"
log: "Non-upstream flavor detected, skipping local registry creation"
enable: ${ENABLE_LOG}

###########
Expand Down Expand Up @@ -93,8 +94,9 @@ tasks:
-t ${{ .inputs.imageRepository }}:${{ .inputs.version }} \
-f ${{ .inputs.dockerfile }} \
--build-arg LOCAL_VERSION=${{ .inputs.version }} \
${{ .inputs.buildOptions }} ${{ .inputs.buildContext }}
echo "false"
${{ .inputs.buildOptions }} ${{ .inputs.buildContext }} \
> /dev/null 2>&1
echo "false"
else
echo "true"
fi
Expand Down Expand Up @@ -234,12 +236,12 @@ tasks:
architecture: ${ARCHITECTURE}
version: ${VERSION}
imageRepository: ghcr.io/defenseunicorns/leapfrogai/api-migrations
- task: publish:tag
- task: utils:tag
with:
current: "ghcr.io/defenseunicorns/leapfrogai/api-migrations:${VERSION}"
new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/api-migrations:${VERSION}"
override: "true"
- task: publish:docker
- task: utils:docker
with:
tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/api-migrations:${VERSION}"
override: "true"
Expand All @@ -265,11 +267,11 @@ tasks:
architecture: ${ARCHITECTURE}
version: ${VERSION}
imageRepository: ghcr.io/defenseunicorns/leapfrogai/leapfrogai-api
- task: publish:tag
- task: utils:tag
with:
current: "ghcr.io/defenseunicorns/leapfrogai/leapfrogai-api:${VERSION}"
new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/leapfrogai-api:${VERSION}"
- task: publish:docker
- task: utils:docker
with:
tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/leapfrogai-api:${VERSION}"

Expand All @@ -290,12 +292,12 @@ tasks:
architecture: ${ARCHITECTURE}
version: ${VERSION}
imageRepository: ghcr.io/defenseunicorns/leapfrogai/ui-migrations
- task: publish:tag
- task: utils:tag
with:
current: "ghcr.io/defenseunicorns/leapfrogai/ui-migrations:${VERSION}"
new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/ui-migrations:${VERSION}"
override: "true"
- task: publish:docker
- task: utils:docker
with:
tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/ui-migrations:${VERSION}"
override: "true"
Expand All @@ -316,11 +318,11 @@ tasks:
architecture: ${ARCHITECTURE}
version: ${VERSION}
imageRepository: ghcr.io/defenseunicorns/leapfrogai/leapfrogai-ui
- task: publish:tag
- task: utils:tag
with:
current: "ghcr.io/defenseunicorns/leapfrogai/leapfrogai-ui:${VERSION}"
new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/leapfrogai-ui:${VERSION}"
- task: publish:docker
- task: utils:docker
with:
tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/leapfrogai-ui:${VERSION}"

Expand All @@ -341,12 +343,12 @@ tasks:
architecture: ${ARCHITECTURE}
version: ${VERSION}
imageRepository: ghcr.io/defenseunicorns/leapfrogai/supabase-migrations
- task: publish:tag
- task: utils:tag
with:
current: "ghcr.io/defenseunicorns/leapfrogai/supabase-migrations:${VERSION}"
new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/supabase-migrations:${VERSION}"
override: "true"
- task: publish:docker
- task: utils:docker
with:
tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/supabase-migrations:${VERSION}"
override: "true"
Expand All @@ -366,11 +368,11 @@ tasks:
architecture: ${ARCHITECTURE}
version: ${VERSION}
imageRepository: ghcr.io/defenseunicorns/leapfrogai/repeater
- task: publish:tag
- task: utils:tag
with:
current: "ghcr.io/defenseunicorns/leapfrogai/repeater:${VERSION}"
new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/repeater:${VERSION}"
- task: publish:docker
- task: utils:docker
with:
tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/repeater:${VERSION}"

Expand All @@ -389,11 +391,11 @@ tasks:
architecture: ${ARCHITECTURE}
version: ${VERSION}
imageRepository: ghcr.io/defenseunicorns/leapfrogai/vllm
- task: publish:tag
- task: utils:tag
with:
current: "ghcr.io/defenseunicorns/leapfrogai/vllm:${VERSION}"
new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/vllm:${VERSION}"
- task: publish:docker
- task: utils:docker
with:
tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/vllm:${VERSION}"

Expand All @@ -412,11 +414,11 @@ tasks:
architecture: ${ARCHITECTURE}
version: ${VERSION}
imageRepository: ghcr.io/defenseunicorns/leapfrogai/llama-cpp-python
- task: publish:tag
- task: utils:tag
with:
current: "ghcr.io/defenseunicorns/leapfrogai/llama-cpp-python:${VERSION}"
new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/llama-cpp-python:${VERSION}"
- task: publish:docker
- task: utils:docker
with:
tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/llama-cpp-python:${VERSION}"

Expand All @@ -435,11 +437,11 @@ tasks:
architecture: ${ARCHITECTURE}
version: ${VERSION}
imageRepository: ghcr.io/defenseunicorns/leapfrogai/text-embeddings
- task: publish:tag
- task: utils:tag
with:
current: "ghcr.io/defenseunicorns/leapfrogai/text-embeddings:${VERSION}"
new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/text-embeddings:${VERSION}"
- task: publish:docker
- task: utils:docker
with:
tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/text-embeddings:${VERSION}"

Expand All @@ -458,11 +460,11 @@ tasks:
architecture: ${ARCHITECTURE}
version: ${VERSION}
imageRepository: ghcr.io/defenseunicorns/leapfrogai/whisper
- task: publish:tag
- task: utils:tag
with:
current: "ghcr.io/defenseunicorns/leapfrogai/whisper:${VERSION}"
new: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/whisper:${VERSION}"
- task: publish:docker
- task: utils:docker
with:
tag: "localhost:${LOCAL_REGISTRY_PORT}/defenseunicorns/leapfrogai/whisper:${VERSION}"

Expand Down
5 changes: 5 additions & 0 deletions tasks/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ includes:
#########################
- deploy-common: https://raw.githubusercontent.com/defenseunicorns/uds-common/82e63be82766a2e550a847af904b2d738c9d3478/tasks/deploy.yaml

###########################
# LEAPFROGAI-SPECIFIC TASKS
###########################
- utils: ./utils.yaml

tasks:
###########
# REUSEABLE
Expand Down
74 changes: 0 additions & 74 deletions tasks/publish.yaml

This file was deleted.

1 change: 1 addition & 0 deletions tasks/setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ includes:
# LEAPFROGAI-SPECIFIC TASKS
###########################
- create: ./create.yaml
- utils: ./utils.yaml

tasks:
- name: e2e-test-user
Expand Down
57 changes: 54 additions & 3 deletions tasks/utils.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,59 @@ tasks:
default: "true"
required: false
actions:
- cmd: |
if [[ ${{ .inputs.enable }} = "true" ]]
- shell:
linux: bash
darwin: bash
cmd: |
if [[ ${{ .inputs.enable }} == "true" ]]; then
printf "\n🐸 ${{ .inputs.log }}\n\n"
fi
mute: true
- name: tag
description: "Re-tags an existing Docker image"
inputs:
current:
description: "The current image tag"
required: true
new:
description: "The new image tag"
required: true
# TODO: remove once Ironbank image for api-migrations and ui-migrations exists
override:
description: "Specifically for packages that are only partially in IronBank (e.g., migrations)"
default: "false"
required: false
actions:
- description: "Re-tag the Docker image"
shell:
linux: bash
darwin: bash
cmd: |
if [[ ${FLAVOR} = "upstream" || ${{ .inputs.override }} = "true" ]]; then
docker tag ${{ .inputs.current }} ${{ .inputs.new }}
fi
- name: docker
description: "Push an existing Docker image to its tagged repository"
inputs:
tag:
description: "The full Docker image tag"
required: true
options:
description: "Extra Docker CLI options"
default: "-q"
required: false
# TODO: remove once Ironbank image for api-migrations and ui-migrations exists
override:
description: "Specifically for packages that are only partially in IronBank (e.g., migrations)"
default: "false"
required: false
actions:
- description: "Push the Docker image"
shell:
linux: bash
darwin: bash
cmd: |
if [[ ${FLAVOR} = "upstream" || ${{ .inputs.override }} = "true" ]]; then
docker push ${{ .inputs.tag }} ${{ .inputs.options }}
fi

0 comments on commit 6068be7

Please sign in to comment.