This repository has been archived by the owner on May 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
132 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# SciOps CICD Pipeline | ||
|
||
## Flow | ||
|
||
#### Rough Explanation | ||
- Trigger: SciOps Workflow repo make push/PR/tag | ||
- Codebook image | ||
- Build Codebook image | ||
- Publish Codebook image(only with repo tag push) | ||
- Worker images | ||
- Build CPU based worker images | ||
- Publish worker images(only with repo tag push) | ||
- GPU based worker image requires manually building and publishing on a dev GPU EC2 instance | ||
|
||
|
||
#### Detailed Flow Diagram | ||
 | ||
|
||
## Setup and Usage | ||
- Enable your personal fork pipeline | ||
- Add Github Actions Secrets to your personal fork settings | ||
- BOT_SSH_KEY: sciops devops deploy key | ||
- REGISTRY_USERNAME: private registry username | ||
- REGISTRY_PASSWORD: private registry password | ||
- Enable the main fork pipeline | ||
- Add the same secrets to the main fork settings | ||
- Do your development | ||
- Push commits to your personal fork | ||
- This will trigger your personal fork's pipeline to run, and it will only run through the image building part of the pipeline as a test before you make a pull request | ||
- Make a pull request to the main fork | ||
- This will trigger the main fork's pipeline to run, only run through the image building part as well to ensure the test before the pull request been merged | ||
- Merge a pull request | ||
- This will trigger the main fork's pipeline, but actually redundant | ||
- Push a tag to the main fork | ||
- This will trigger the main fork's pipeline and publish all the images to the private registry | ||
- Update worker terraform image tag input | ||
- Check instruction [here](https://github.com/yambottle/dj-gitops/tree/main/infrastructures/tf/sciops_workers) | ||
|
31 changes: 31 additions & 0 deletions
31
docker-template/u24_codebook_env/dist/alpine/codebook.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
## docker build --build-arg JHUB_VER=1.4.2 --build-arg PY_VER=3.8 --build-arg DIST=debian --build-arg DEPLOY_KEY=wt-ephys-no-curation-deploy.pem --build-arg REPO_OWNER=dj-sciops --build-arg REPO_NAME=wt-ephys-no-curation -f codebook.Dockerfile -t registry.vathes.com/sciops/codebook-wt-ephys-no-curation:v0.0.0 . | ||
|
||
## Single Stage | ||
ARG JHUB_VER | ||
ARG PY_VER | ||
ARG DIST | ||
ARG CODEBOOK_BASE_HASH | ||
FROM datajoint/djlabhub:${JHUB_VER}-py${PY_VER}-${DIST}-${CODEBOOK_BASE_HASH} | ||
|
||
USER root | ||
RUN apk add openssh git vim | ||
USER anaconda | ||
|
||
ARG DEPLOY_KEY | ||
COPY --chown=anaconda $DEPLOY_KEY $HOME/.ssh/id_ed25519 | ||
RUN chmod u=r,g-rwx,o-rwx $HOME/.ssh/id_ed25519 | ||
|
||
ARG REPO_OWNER | ||
ARG REPO_NAME | ||
WORKDIR /tmp | ||
RUN ssh-keyscan -t ed25519 github.com >> $HOME/.ssh/known_hosts && \ | ||
git clone [email protected]:${REPO_OWNER}/${REPO_NAME}.git && \ | ||
pip install ./${REPO_NAME} && \ | ||
cp -r ./${REPO_NAME}/notebooks/ /home/ && \ | ||
cp -r ./${REPO_NAME}/images/ /home/notebooks/ && \ | ||
cp -r ./${REPO_NAME}/user_data/ /home/notebooks/ && \ | ||
cp ./${REPO_NAME}/README.md /home/notebooks/ && \ | ||
rm -rf /tmp/${REPO_NAME} && \ | ||
rm -rf $HOME/.ssh/ | ||
|
||
WORKDIR /home/notebooks |
17 changes: 17 additions & 0 deletions
17
docker-template/u24_codebook_env/dist/alpine/docker-compose-codebook_env.yaml
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,17 @@ | ||
# cd ./docker-template/codebook_env && set -a && source .env && docker-compose -f dist/alpine/docker-compose-codebook_env.yaml build | ||
version: '2.4' | ||
services: | ||
codebook_env: | ||
build: | ||
# only necessary if rebuilding image | ||
context: ../../ | ||
dockerfile: ./dist/alpine/codebook.Dockerfile | ||
args: | ||
- JHUB_VER | ||
- PY_VER | ||
- DIST | ||
- CODEBOOK_BASE_HASH | ||
- DEPLOY_KEY | ||
- REPO_OWNER | ||
- REPO_NAME | ||
image: registry.vathes.com/sciops/codebook_${REPO_NAME}:jhub${JHUB_VER}-py${PY_VER}-${DIST}-${WORKFLOW_VERSION} |
29 changes: 29 additions & 0 deletions
29
docker-template/u24_codebook_env/dist/debian/codebook.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
## docker build --build-arg JHUB_VER=1.4.2 --build-arg PY_VER=3.8 --build-arg DIST=debian --build-arg CODEBOOK_BASE_HASH=a7ee3ce --build-arg DEPLOY_KEY=wt-ephys-no-curation-deploy.pem --build-arg REPO_OWNER=dj-sciops --build-arg REPO_NAME=wt-ephys-no-curation -f codebook.Dockerfile -t registry.vathes.com/sciops/codebook-wt-ephys-no-curation:v0.0.0 . | ||
|
||
## Single Stage | ||
ARG JHUB_VER | ||
ARG PY_VER | ||
ARG DIST | ||
ARG CODEBOOK_BASE_HASH | ||
FROM datajoint/djlabhub:${JHUB_VER}-py${PY_VER}-${DIST}-${CODEBOOK_BASE_HASH} | ||
|
||
ARG DEPLOY_KEY | ||
COPY --chown=anaconda $DEPLOY_KEY $HOME/.ssh/id_ed25519 | ||
RUN chmod u=r,g-rwx,o-rwx $HOME/.ssh/id_ed25519 && \ | ||
printf "ssh\ngit" >> /tmp/apt_requirements.txt && \ | ||
/entrypoint.sh echo "installed" | ||
|
||
ARG REPO_OWNER | ||
ARG REPO_NAME | ||
WORKDIR /tmp | ||
RUN ssh-keyscan -t ed25519 github.com >> $HOME/.ssh/known_hosts && \ | ||
git clone [email protected]:${REPO_OWNER}/${REPO_NAME}.git && \ | ||
pip install ./${REPO_NAME} && \ | ||
cp -r ./${REPO_NAME}/notebooks/ /home/ && \ | ||
cp -r ./${REPO_NAME}/images/ /home/notebooks/ || true && \ | ||
cp -r ./${REPO_NAME}/user_data/ /home/ && \ | ||
cp ./${REPO_NAME}/README.md /home/notebooks/ && \ | ||
rm -rf /tmp/${REPO_NAME} && \ | ||
rm -rf $HOME/.ssh/ | ||
|
||
WORKDIR /home/notebooks |
17 changes: 17 additions & 0 deletions
17
docker-template/u24_codebook_env/dist/debian/docker-compose-codebook_env.yaml
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,17 @@ | ||
# cd ./docker-template/codebook_env && set -a && source .env && docker-compose -f dist/debian/docker-compose-codebook_env.yaml build | ||
version: '2.4' | ||
services: | ||
codebook_env: | ||
build: | ||
# only necessary if rebuilding image | ||
context: ../../ | ||
dockerfile: ./dist/debian/codebook.Dockerfile | ||
args: | ||
- JHUB_VER | ||
- PY_VER | ||
- DIST | ||
- CODEBOOK_BASE_HASH | ||
- DEPLOY_KEY | ||
- REPO_OWNER | ||
- REPO_NAME | ||
image: registry.vathes.com/sciops/codebook_${REPO_NAME}:jhub${JHUB_VER}-py${PY_VER}-${DIST}-${WORKFLOW_VERSION} |