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

Modify triggers and remove dockerdeploy in github workflow file #69

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
64 changes: 34 additions & 30 deletions .github/workflows/run_tests.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Relation Engine test and deploy
on:
[push, pull_request]
push:
branches: [ develop, master ]
pull_request_target:
jobs:
run_tests:
runs-on: ubuntu-latest
Expand All @@ -17,33 +19,35 @@ jobs:
docker-compose run re_api sh scripts/run_tests.sh
docker-compose down --remove-orphans

docker_build_and_push:
runs-on: ubuntu-latest
needs: run_tests
if: (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master') && github.event_name == 'push' && !contains(github.event.head_commit.message, 'skip_docker_build')
Copy link
Collaborator

Choose a reason for hiding this comment

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

This line skips the docker build/push if the commit message contains 'skip_docker_build'. I think it would be more sensible to add documentation about this and have the builds pushed to dockerhub by default.

steps:
- name: checkout git repo
uses: actions/checkout@v2

- name: copy VERSION to TAG_NAME
shell: bash
run: |
mkdir -p .target
cp VERSION .target/TAG_NAME

- name: set env vars
shell: bash
run: |
echo "DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_ENV
echo "BRANCH=$(git symbolic-ref --short HEAD)" >> $GITHUB_ENV
echo "COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV

- name: build and push to dockerhub
uses: opspresso/action-docker@master
with:
args: --docker
env:
USERNAME: ${{ secrets.DOCKER_USERNAME }}
PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKERFILE: "Dockerfile"
IMAGE_NAME: "kbase/relation_engine_api"
# docker_build_and_push:
# runs-on: ubuntu-latest
# needs: run_tests
# if: (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master') && github.event_name == 'push' && !contains(github.event.head_commit.message, 'skip_docker_build')
# steps:
# - name: checkout git repo
# uses: actions/checkout@v2
#
# - name: copy VERSION to TAG_NAME
# shell: bash
# run: |
# mkdir -p .target
# cp VERSION .target/TAG_NAME
#
# - name: set env vars
# shell: bash
# run: |
# echo "DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_ENV
# echo "BRANCH=$(git symbolic-ref --short HEAD)" >> $GITHUB_ENV
# echo "COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
#
# - name: build and push to dockerhub
# uses: opspresso/action-docker@master
# with:
# args: --docker
# env:
# USERNAME: ${{ secrets.DOCKER_USERNAME }}
# [push, pull_request]
# PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
# DOCKERFILE: "Dockerfile"
# IMAGE_NAME: "kbase/relation_engine_api"
4 changes: 2 additions & 2 deletions relation_engine_server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,9 @@ make test

## Deployment

The docker image is pushed to Docker Hub when new commits are made to master. The script that runs when pushing to docker hub is found in `hooks/build`.
Deploy the image by running the `scripts/docker_deploy` script.

Alternatively, set the image name in `scripts/local-build.sh` and run it to build and deploy locally, which may be a lot faster.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This comment is still valid -- why are you deleting it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's no longer called local-build.sh, and I don't know whether or not it is faster compared to Github Actions. It was definitely faster compared to the Docker Hub build hook, but we no longer use that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, we no longer set the image name within the script

The image tag will be taken from the `VERSION` file found in the root of the repo.

## Project anatomy

Expand Down