-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #222 from sunya-ch/ci
add local db, remove kubelet, update push-pr
- Loading branch information
Showing
60 changed files
with
1,907 additions
and
387 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,111 @@ | ||
name: BuildPushDeployImage | ||
name: Build-Push Kepler Model Server Image | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
workflow_call: | ||
secrets: | ||
docker_username: | ||
description: 'Docker username' | ||
required: false | ||
docker_password: | ||
description: 'Docker password' | ||
required: false | ||
inputs: | ||
base_change: | ||
description: 'Change flag on base image' | ||
required: true | ||
type: string | ||
image_repo: | ||
description: 'The image repo to use' | ||
required: true | ||
type: string | ||
image_tag: | ||
description: 'The image tag to use' | ||
required: true | ||
type: string | ||
push: | ||
description: 'Push image' | ||
required: false | ||
type: string | ||
default: false | ||
|
||
|
||
env: | ||
base_change: ${{ inputs.base_change }} | ||
base_image: ${{ inputs.image_repo }}/kepler_model_server_base:${{ inputs.image_tag }} | ||
image: ${{ inputs.image_repo }}/kepler_model_server:${{ inputs.image_tag }} | ||
|
||
jobs: | ||
|
||
changes: | ||
check-secret: | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
src: ${{ steps.changes.outputs.src }} | ||
available: ${{ steps.check-secret.outputs.available }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dorny/paths-filter@v2 | ||
id: changes | ||
with: | ||
filters: | | ||
src: | ||
- 'dockerfiles/requirements.txt' | ||
- 'dockerfiles/Dockerfile.base' | ||
- '.github/workflows/build-push.yml' | ||
- name: Check Secret | ||
id: check-secret | ||
env: | ||
SECRET: ${{ secrets.docker_password }} | ||
run: | | ||
if [ "$SECRET" == "" ]; then | ||
echo "available=false" >> "$GITHUB_OUTPUT" | ||
else | ||
echo "available=true" >> "$GITHUB_OUTPUT" | ||
fi | ||
check-base-exist: | ||
runs-on: ubuntu-latest | ||
|
||
buildbase: | ||
needs: changes | ||
if: ${{ needs.changes.outputs.src == 'true' }} | ||
outputs: | ||
exists: ${{ steps.check-base-exist.outputs.exists }} | ||
|
||
steps: | ||
- name: Check if Docker base image exists | ||
id: check-base-exist | ||
run: | | ||
if docker pull ${{ env.base_image }}; then | ||
echo "exists=true" >> "$GITHUB_OUTPUT" | ||
else | ||
echo "exists=false" >> "$GITHUB_OUTPUT" | ||
fi | ||
build: | ||
runs-on: ubuntu-latest | ||
needs: [check-secret, check-base-exist] | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to Quay | ||
if: ${{ (github.repository_owner == 'sustainable-computing-io') && (github.ref == 'refs/heads/main') }} | ||
- name: Login to Docker | ||
if: ${{ needs.check-secret.outputs.available == 'true' }} | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: quay.io/sustainable_computing_io | ||
username: ${{ secrets.BOT_NAME }} | ||
password: ${{ secrets.BOT_TOKEN }} | ||
- name: Build and push base image | ||
registry: ${{ inputs.image_repo }} | ||
username: ${{ secrets.docker_username }} | ||
password: ${{ secrets.docker_password }} | ||
- name: Build-push base image | ||
if: ${{ (needs.check-secret.outputs.available == 'true') && ((needs.check-base-exist.outputs.exists == 'false') || (env.base_change == 'true')) }} | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: dockerfiles | ||
platforms: linux/amd64 | ||
push: true | ||
tags: quay.io/sustainable_computing_io/kepler_model_server_base:v0.7 | ||
tags: ${{ env.base_image }} | ||
file: dockerfiles/Dockerfile.base | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
platforms: linux/amd64 | ||
push: true | ||
tags: quay.io/sustainable_computing_io/kepler_model_server:latest,quay.io/sustainable_computing_io/kepler_model_server:v0.7 | ||
file: dockerfiles/Dockerfile | ||
|
||
build: | ||
needs: [changes] | ||
if: ${{ needs.changes.outputs.src == 'false' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to Quay | ||
if: ${{ (github.repository_owner == 'sustainable-computing-io') && (github.ref == 'refs/heads/main') }} | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: quay.io/sustainable_computing_io | ||
username: ${{ secrets.BOT_NAME }} | ||
password: ${{ secrets.BOT_TOKEN }} | ||
- name: Build and push Docker image | ||
- name: Replace value in file | ||
if: ${{ (needs.check-secret.outputs.available == 'true') && ((needs.check-base-exist.outputs.exists == 'false') || (env.base_change == 'true')) }} | ||
run: | | ||
sed -i "s|quay.io/sustainable_computing_io/kepler_model_server_base:v0.7|${{ env.base_image }}|" dockerfiles/Dockerfile | ||
- name: Build-push image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
platforms: linux/amd64 | ||
push: true | ||
tags: quay.io/sustainable_computing_io/kepler_model_server:latest,quay.io/sustainable_computing_io/kepler_model_server:v0.7 | ||
push: ${{ inputs.push }} | ||
tags: ${{ env.image }} | ||
file: dockerfiles/Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# manually run on collect needed | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
collect-data: | ||
uses: ./.github/workflows/collect-data-self-hosted.yml | ||
strategy: | ||
matrix: | ||
instance_type: [i3.metal] | ||
max-parallel: 1 | ||
with: | ||
instance_type: ${{ matrix.instance_type }} | ||
ami_id: 'ami-0e4d0bb9670ea8db0' | ||
github_repo: ${{ github.repository }} | ||
model_server_image: ${{ vars.IMAGE_REPO }}/kepler-model-server:v0.7 | ||
secrets: | ||
self_hosted_github_token: ${{ secrets.GH_SELF_HOSTED_RUNNER_TOKEN }} | ||
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
security_group_id: ${{ secrets.AWS_SECURITY_GROUP_ID }} | ||
aws_region: ${{ secrets.AWS_REGION }} | ||
|
||
train-model: | ||
strategy: | ||
matrix: | ||
instance_type: [i3.metal] | ||
uses: ./.github/workflows/train-model.yml | ||
with: | ||
pipeline_name: std_v0.7 | ||
instance_type: ${{ matrix.instance_type }} | ||
ami_id: 'ami-0e4d0bb9670ea8db0' | ||
github_repo: ${{ github.repository }} | ||
model_server_image: ${{ vars.IMAGE_REPO }}/kepler-model-server:v0.7 | ||
trainers: LogisticRegressionTrainer,ExponentialRegressionTrainer,SGDRegressorTrainer,GradientBoostingRegressorTrainer,XgboostFitTrainer | ||
secrets: | ||
self_hosted_github_token: ${{ secrets.GH_SELF_HOSTED_RUNNER_TOKEN }} | ||
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws_region: ${{ secrets.AWS_REGION }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.