Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new github workflow files for the new nightly workflow #2641

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions .github/workflows/docker_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Build and push docker nightly to temp ECR repo

on:
workflow_dispatch:
inputs:
mode:
description: 'release/nightly, default is nightly'
required: true
default: 'nightly'
type: choice
options:
- nightly
- release
workflow_call:
inputs:
mode:
description: 'release/nightly, default is nightly'
type: string
required: true
default: 'nightly'

permissions:
id-token: write
contents: read

env:
AWS_ECR_REPO: "185921645874.dkr.ecr.us-east-1.amazonaws.com/djl-ci-temp"

jobs:
create-aarch64-runner:
runs-on: [ self-hosted, scheduler ]
steps:
- name: Create new Graviton instance
id: create_aarch64
run: |
cd /home/ubuntu/djl_benchmark_script/scripts
token=$( curl -X POST -H "Authorization: token ${{ secrets.ACTION_RUNNER_PERSONAL_TOKEN }}" \
https://api.github.com/repos/deepjavalibrary/djl-serving/actions/runners/registration-token \
--fail \
| jq '.token' | tr -d '"' )
./start_instance.sh action_graviton $token djl-serving
outputs:
aarch64_instance_id: ${{ steps.create_aarch64.outputs.action_graviton_instance_id }}

nightly-aarch64:
runs-on: [ self-hosted, aarch64 ]
timeout-minutes: 60
needs: create-aarch64-runner
steps:
- uses: actions/checkout@v4
- name: Clean docker env
working-directory: serving/docker
run: |
yes | docker system prune -a --volumes
- name: Login to Docker
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: install awscli
run: |
sudo apt-get update
sudo apt-get install awscli -y
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::185921645874:role/github-actions-djl-serving
aws-region: us-east-1
- name: Pull and sync to docker hub
working-directory: serving/docker
run: |
DJL_VERSION=$(awk -F '=' '/djl / {gsub(/ ?"/, "", $2); print $2}' ../../gradle/libs.versions.toml)
ECR_REGION=$(echo "${{ env.AWS_ECR_REPO }}" | awk -F. '{print $4}')
aws ecr get-login-password --region $ECR_REGION | docker login --username AWS --password-stdin ${{env.AWS_ECR_REPO}}
./scripts/pull_and_retag.sh $DJL_VERSION deepjavalibrary/djl-serving ${{ inputs.mode }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the pull and retag script needs some changes as well. It pulls from dockerhub currently, but we'd want it to pull from the tmp ecr. We can do that in the other PR, want to make sure that's going to be included

- name: Pull and sync to ECR
working-directory: serving/docker
run: |
DJL_VERSION=$(awk -F '=' '/djl / {gsub(/ ?"/, "", $2); print $2}' ../../gradle/libs.versions.toml)
repo="125045733377.dkr.ecr.us-east-1.amazonaws.com/djl-serving"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's also move this to an env var, maybe these two to differentiate?
AWS_TMP_ECR
AWS_STAGING_ECR

aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $repo
./scripts/pull_and_retag.sh $DJL_VERSION $repo ${{ inputs.mode }}
- name: Retag image for release latest
if: ${{ inputs.mode == 'release' }}
working-directory: serving/docker
run: |
DJL_VERSION=$(awk -F '=' '/djl / {gsub(/ ?"/, "", $2); print $2}' ../../gradle/libs.versions.toml)
docker tag deepjavalibrary/djl-serving:${DJL_VERSION} deepjavalibrary/djl-serving:latest
docker push deepjavalibrary/djl-serving:latest
- name: Clean docker env
working-directory: serving/docker
run: |
yes | docker system prune -a --volumes
stop-aarch64-runner:
if: always()
runs-on: [ self-hosted, scheduler ]
needs: [nightly-aarch64, create-aarch64-runner]
steps:
- name: Stop all instances
run: |
cd /home/ubuntu/djl_benchmark_script/scripts
instance_id=${{ needs.create-aarch64-runner.outputs.aarch64_instance_id }}
./stop_instance.sh $instance_id
62 changes: 62 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Nightly Pipeline

on:
workflow_dispatch:
inputs:
mode:
description: 'release/nightly, default is nightly'
required: true
default: 'nightly'
type: choice
options:
- nightly
- release
workflow_call:
inputs:
mode:
description: 'release/nightly, default is nightly'
type: string
required: true
default: 'nightly'
schedule:
- cron: '0 13 * * *'


permissions:
id-token: write
contents: read

jobs:
build:
uses: ./.github/workflows/docker-nightly-publish.yml
secrets: inherit
with:
mode: ${{ inputs.mode }}
get_image_tag_suffix:
outputs:
test_image_tag_suffix: ${{ steps.get_image_tag_suffix.test_image_tag_suffix }}
needs: [build]
runs-on: ubuntu-latest
steps:
- name: get_image_tag_suffix
id: get_image_tag_suffix
run: |
if ${{ inputs.mode == 'nightly'}}; then
test_image_tag_suffix='nightly'
fi
if ${{ inputs.mode == 'release'}}; then
test_image_tag_suffix='${{ needs.build.outputs.djl_version}}-${GITHUB_RUN_ID}'
fi
echo "test_image_tag_suffix=$test_image_tag_suffix" >> $GITHUB_OUTPUT
integration-test:
needs: [get_image_tag_suffix]
uses: ./.github/workflows/integration.yml
secrets: inherit
with:
tag-suffix:: ${{ needs.get_image_tag_suffix.outputs.test_image_tag_suffix }}
publish:
needs: [integration-test, get_image_tag_suffix]
uses: ./.github/workflows/docker_publish.yml
secrets: inherit
with:
mode: ${{ inputs.mode }}
Loading