Skip to content

Commit

Permalink
/deploy sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
sliu008 committed Sep 20, 2023
1 parent 3f54a10 commit 7889965
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 13 deletions.
80 changes: 67 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,7 @@ jobs:
id: pypi-test-publish
if: |
github.ref == 'refs/heads/develop' ||
startsWith(github.ref, 'refs/heads/release') ||
github.event.head_commit.message == '/deploy sit' ||
github.event.head_commit.message == '/deploy uat' ||
github.event.head_commit.message == '/deploy sandbox'
startsWith(github.ref, 'refs/heads/release')
env:
POETRY_PYPI_TOKEN_TESTPYPI: ${{secrets.TEST_PYPI_API_TOKEN}}
run: |
Expand Down Expand Up @@ -429,10 +426,7 @@ jobs:
if: |
github.ref == 'refs/heads/develop' ||
github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/heads/release') ||
github.event.head_commit.message == '/deploy sit' ||
github.event.head_commit.message == '/deploy uat' ||
github.event.head_commit.message == '/deploy sandbox'
startsWith(github.ref, 'refs/heads/release')
uses: docker/build-push-action@v3
with:
context: .
Expand All @@ -450,9 +444,7 @@ jobs:
if: |
github.ref == 'refs/heads/develop' ||
github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/heads/release') ||
github.event.head_commit.message == '/deploy sit' ||
github.event.head_commit.message == '/deploy uat'
startsWith(github.ref, 'refs/heads/release')
uses: vitr/actions-build-and-upload-to-ecs@master
with:
access_key_id: ${{ secrets[format('AWS_ACCESS_KEY_ID_SERVICES_{0}', env.TARGET_ENV_UPPERCASE)] }}
Expand All @@ -471,7 +463,69 @@ jobs:
if: |
github.ref == 'refs/heads/develop' ||
github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/heads/release') ||
startsWith(github.ref, 'refs/heads/release')
uses: vitr/actions-build-and-upload-to-ecs@master
with:
access_key_id: ${{ secrets[format('AWS_ACCESS_KEY_ID_CUMULUS_{0}', env.TARGET_ENV_UPPERCASE)] }}
secret_access_key: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_CUMULUS_{0}', env.TARGET_ENV_UPPERCASE)] }}
account_id: ${{ secrets[format('AWS_ACCOUNT_ID_CUMULUS_{0}', env.TARGET_ENV_UPPERCASE)] }}
repo: podaac/tig
region: us-west-2
tags: ${{ env.the_version }}
create_repo: true
dockerfile: ./docker/lambdaDockerfile
extra_build_args: --build-arg SOURCE=${{ env.pyproject_name }}==${{ env.the_version }}


## Local tig docker builds

- name: Build Local TIG and push Docker image
if: |
github.event.head_commit.message == '/deploy sit' ||
github.event.head_commit.message == '/deploy uat' ||
github.event.head_commit.message == '/deploy sandbox'
run: |
local_tig=$(find dist -type f -name "*.whl")
echo "local_tig=${local_tig}" >> $GITHUB_ENV
- name: Build Local TIG and push Docker image
if: |
github.event.head_commit.message == '/deploy sit' ||
github.event.head_commit.message == '/deploy uat' ||
github.event.head_commit.message == '/deploy sandbox'
uses: docker/build-push-action@v3
with:
context: .
file: ./docker/lambdaDockerfile
push: true
pull: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
extra_build_args: --build-arg DIST_PATH="dist/" --build-arg SOURCE=${{ env.local_tig }}


## Build and publish to Service ECR
- name: Upload Local TIG Docker image to Service ECR
if: |
github.event.head_commit.message == '/deploy sit' ||
github.event.head_commit.message == '/deploy uat'
uses: vitr/actions-build-and-upload-to-ecs@master
with:
access_key_id: ${{ secrets[format('AWS_ACCESS_KEY_ID_SERVICES_{0}', env.TARGET_ENV_UPPERCASE)] }}
secret_access_key: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_SERVICES_{0}', env.TARGET_ENV_UPPERCASE)] }}
account_id: ${{ secrets[format('AWS_ACCOUNT_ID_SERVICES_{0}', env.TARGET_ENV_UPPERCASE)] }}
repo: podaac/tig
region: us-west-2
tags: ${{ env.the_version }}
create_repo: true
dockerfile: ./docker/lambdaDockerfile
extra_build_args: --build-arg DIST_PATH="dist/= --build-arg SOURCE=${{ env.local_tig }}


## Build and publish to Cumulus ECR
- name: Upload Local TIG Docker image to Cumulus ECR
if: |
github.event.head_commit.message == '/deploy sit' ||
github.event.head_commit.message == '/deploy uat' ||
github.event.head_commit.message == '/deploy sandbox'
Expand All @@ -485,7 +539,7 @@ jobs:
tags: ${{ env.the_version }}
create_repo: true
dockerfile: ./docker/lambdaDockerfile
extra_build_args: --build-arg SOURCE=${{ env.pyproject_name }}==${{ env.the_version }}
extra_build_args: --build-arg DIST_PATH="dist/= --build-arg SOURCE=${{ env.local_tig }}


# #########################################################################
Expand Down
4 changes: 4 additions & 0 deletions docker/lambdaDockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ RUN apt-get update && \
RUN mkdir -p ${FUNCTION_DIR}
WORKDIR ${FUNCTION_DIR}

COPY $DIST_PATH $DIST_PATH

# install tig into working directory so we can call lambda
#RUN pip3 install --force --target ${FUNCTION_DIR} $SOURCE

RUN pip3 install --no-cache-dir --force --user --index-url https://pypi.org/simple/ --extra-index-url https://test.pypi.org/simple/ --target ${FUNCTION_DIR} $SOURCE

RUN rm -rf $DIST_PATH

# Install the function's dependencies
RUN pip install \
--target ${FUNCTION_DIR} \
Expand Down

0 comments on commit 7889965

Please sign in to comment.