Skip to content

Commit

Permalink
Merge branch 'develop' into DATAUP-233-wdio-travis
Browse files Browse the repository at this point in the history
  • Loading branch information
briehl committed Oct 21, 2020
2 parents cc1a37d + 498b63c commit 7b97c27
Show file tree
Hide file tree
Showing 21 changed files with 373 additions and 247 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_prodrc_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ jobs:
env:
PR: "${{ github.event.pull_request.number }}"
SHA: "${{ github.event.pull_request.head.sha }}"
DOCKER_ACTOR: "${{ github.actor }}"
DOCKER_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
DOCKER_ACTOR: "jsfillman"
DOCKER_TOKEN: "${{ secrets.GHCR_TOKEN }}"
run: "./.github/workflows/scripts/build_prodrc_pr.sh\n"
4 changes: 2 additions & 2 deletions .github/workflows/build_test_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ jobs:
env:
PR: "${{ github.event.pull_request.number }}"
SHA: "${{ github.event.pull_request.head.sha }}"
DOCKER_ACTOR: "${{ github.actor }}"
DOCKER_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
DOCKER_ACTOR: "jsfillman"
DOCKER_TOKEN: "${{ secrets.GHCR_TOKEN }}"
run: "./.github/workflows/scripts/build_test_pr.sh\n"
27 changes: 27 additions & 0 deletions .github/workflows/build_truss_pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Build Truss Branch Image
'on':
pull_request:
branches:
- truss
types:
- opened
- synchronize
- ready_for_review
jobs:
docker_build:
runs-on: ubuntu-latest
steps:
- name: Check out GitHub Repo
if: github.event.pull_request.draft == false
with:
ref: "${{ github.event.pull_request.head.sha }}"
uses: actions/checkout@v2
- name: Build and Push to Packages
if: github.event.pull_request.draft == false
env:
PR: "${{ github.event.pull_request.number }}"
SHA: "${{ github.event.pull_request.head.sha }}"
DOCKER_ACTOR: "jsfillman"
DOCKER_TOKEN: "${{ secrets.GHCR_TOKEN }}"
run: "./.github/workflows/scripts/build_truss_pr.sh\n"
23 changes: 23 additions & 0 deletions .github/workflows/build_truss_push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Build Truss Image Push
'on':
push:
branches:
- truss
jobs:
docker_build:
runs-on: ubuntu-latest
steps:
- name: Check out GitHub Repo
if: github.event.pull_request.draft == false
with:
ref: "${{ github.event.pull_request.head.sha }}"
uses: actions/checkout@v2
- name: Build and Push to Packages
if: github.event.pull_request.draft == false
env:
PR: "${{ github.event.pull_request.number }}"
SHA: "${{ github.event.pull_request.head.sha }}"
DOCKER_ACTOR: "jsfillman"
DOCKER_TOKEN: "${{ secrets.GHCR_TOKEN }}"
run: "./.github/workflows/scripts/build_truss_push.sh\n"
9 changes: 5 additions & 4 deletions .github/workflows/scripts/build_prodrc_pr.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#! /usr/bin/env bash

export MY_APP=$(echo "${GITHUB_REPOSITORY}"/$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//"))
export MY_ORG=$(echo "${GITHUB_REPOSITORY}" | awk -F / '{print $1}')
export MY_APP=$(echo "${GITHUB_REPOSITORY}" | awk -F / '{print $2}')
export DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
export BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
export COMMIT=$(echo "$SHA" | cut -c -7)

docker login -u "$DOCKER_ACTOR" -p "$DOCKER_TOKEN" docker.pkg.github.com
docker login -u "$DOCKER_ACTOR" -p "$DOCKER_TOKEN" ghcr.io
docker build --build-arg BUILD_DATE="$DATE" \
--build-arg COMMIT="$COMMIT" \
--build-arg BRANCH="$GITHUB_HEAD_REF" \
--build-arg PULL_REQUEST="$PR" \
--label us.kbase.vcs-pull-req="$PR" \
-t docker.pkg.github.com/"$MY_APP":"pr-""$PR" .
docker push docker.pkg.github.com/"$MY_APP":"pr-""$PR"
-t ghcr.io/"$MY_ORG"/"$MY_APP":"pr-""$PR" .
docker push ghcr.io/"$MY_ORG"/"$MY_APP":"pr-""$PR"
10 changes: 6 additions & 4 deletions .github/workflows/scripts/build_test_pr.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#! /usr/bin/env bash

export MY_APP=$(echo "${GITHUB_REPOSITORY}"/$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//")"-develop")
export MY_ORG=$(echo "${GITHUB_REPOSITORY}" | awk -F / '{print $1}')
export MY_APP=$(echo $(echo "${GITHUB_REPOSITORY}" | awk -F / '{print $2}')"-develop")
export DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
export BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
export COMMIT=$(echo "$SHA" | cut -c -7)

docker login -u "$DOCKER_ACTOR" -p "$DOCKER_TOKEN" docker.pkg.github.com
echo $DOCKER_TOKEN | docker login ghcr.io -u $DOCKER_ACTOR --password-stdin
docker build --build-arg BUILD_DATE="$DATE" \
--build-arg COMMIT="$COMMIT" \
--build-arg BRANCH="$GITHUB_HEAD_REF" \
--build-arg PULL_REQUEST="$PR" \
--label us.kbase.vcs-pull-req="$PR" \
-t docker.pkg.github.com/"$MY_APP":"pr-""$PR" .
docker push docker.pkg.github.com/"$MY_APP":"pr-""$PR"
-t ghcr.io/"$MY_ORG"/"$MY_APP":"pr-""$PR" .
docker push ghcr.io/"$MY_ORG"/"$MY_APP":"pr-""$PR"

17 changes: 17 additions & 0 deletions .github/workflows/scripts/build_truss_pr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#! /usr/bin/env bash

export MY_ORG=$(echo "${GITHUB_REPOSITORY}" | awk -F / '{print $1}')
export MY_APP=$(echo $(echo "${GITHUB_REPOSITORY}" | awk -F / '{print $2}')"-truss")
export DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
export BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
export COMMIT=$(echo "$SHA" | cut -c -7)

echo $DOCKER_TOKEN | docker login ghcr.io -u $DOCKER_ACTOR --password-stdin
docker build --build-arg BUILD_DATE="$DATE" \
--build-arg COMMIT="$COMMIT" \
--build-arg BRANCH="$GITHUB_HEAD_REF" \
--build-arg PULL_REQUEST="$PR" \
--label us.kbase.vcs-pull-req="$PR" \
-t ghcr.io/"$MY_ORG"/"$MY_APP":"pr-""$PR" .
docker push ghcr.io/"$MY_ORG"/"$MY_APP":"pr-""$PR"

14 changes: 14 additions & 0 deletions .github/workflows/scripts/build_truss_push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#! /usr/bin/env bash

export MY_ORG=$(echo "${GITHUB_REPOSITORY}" | awk -F / '{print $1}')
export MY_APP=$(echo "${GITHUB_REPOSITORY}" | awk -F / '{print $2}')"-truss"
export DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
export BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
export COMMIT=$(echo "$SHA" | cut -c -7)

docker login -u "$DOCKER_ACTOR" -p "$DOCKER_TOKEN" ghcr.io
docker build --build-arg BUILD_DATE="$DATE" \
--build-arg COMMIT="$COMMIT" \
--build-arg BRANCH="$GITHUB_HEAD_REF" \
-t ghcr.io/"$MY_ORG"/"$MY_APP":"latest" .
docker push ghcr.io/"$MY_ORG"/"$MY_APP":"latest"
11 changes: 6 additions & 5 deletions .github/workflows/scripts/tag_environments.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
#! /usr/bin/env bash
# Add vars for PR & environments to yaml, as called from external script

export MY_APP=$(echo "${GITHUB_REPOSITORY}"/$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//"))
export MY_ORG=$(echo "${GITHUB_REPOSITORY}" | awk -F / '{print $1}')
export MY_APP=$(echo "${GITHUB_REPOSITORY}" | awk -F / '{print $2}')
export DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
export BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
export COMMIT=$(echo "$SHA" | cut -c -7)
Expand All @@ -15,7 +16,7 @@ else
fi

echo "Dev or Prod:" $DEV_PROD
docker login -u "$DOCKER_ACTOR" -p "$DOCKER_TOKEN" docker.pkg.github.com
docker pull docker.pkg.github.com/"$IMAGE":"$IMAGE_TAG"
docker tag docker.pkg.github.com/"$IMAGE":"$IMAGE_TAG" docker.pkg.github.com/"$IMAGE":"$TARGET"
docker push docker.pkg.github.com/"$IMAGE":"$TARGET"
docker login -u "$DOCKER_ACTOR" -p "$DOCKER_TOKEN" ghcr.io
docker pull ghcr.io/"$MY_ORG"/"$IMAGE":"$IMAGE_TAG"
docker tag ghcr.io/"$MY_ORG"/"$IMAGE":"$IMAGE_TAG" ghcr.io/"$MY_ORG"/"$IMAGE":"$TARGET"
docker push ghcr.io/"$MY_ORG"/"$IMAGE":"$TARGET"
11 changes: 6 additions & 5 deletions .github/workflows/scripts/tag_prod_latest.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#! /usr/bin/env bash

export MY_APP=$(echo "${GITHUB_REPOSITORY}"/$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//"))
export MY_ORG=$(echo "${GITHUB_REPOSITORY}" | awk -F / '{print $1}')
export MY_APP=$(echo "${GITHUB_REPOSITORY}" | awk -F / '{print $2}')
export DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
export BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
export COMMIT=$(echo "$SHA" | cut -c -7)

docker login -u "$DOCKER_ACTOR" -p "$DOCKER_TOKEN" docker.pkg.github.com
docker pull docker.pkg.github.com/"$MY_APP":"pr-""$PR"
docker tag docker.pkg.github.com/"$MY_APP":"pr-""$PR" docker.pkg.github.com/"$MY_APP":"latest"
docker push docker.pkg.github.com/"$MY_APP":"latest"
docker login -u "$DOCKER_ACTOR" -p "$DOCKER_TOKEN" ghcr.io
docker pull ghcr.io/"$MY_ORG"/"$MY_APP":"pr-""$PR"
docker tag ghcr.io/"$MY_ORG"/"$MY_APP":"pr-""$PR" ghcr.io/"$MY_ORG"/"$MY_APP":"latest"
docker push ghcr.io/"$MY_ORG"/"$MY_APP":"latest"
11 changes: 6 additions & 5 deletions .github/workflows/scripts/tag_test_latest.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#! /usr/bin/env bash

export MY_APP=$(echo "${GITHUB_REPOSITORY}"/$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//")"-develop")
export MY_ORG=$(echo "${GITHUB_REPOSITORY}" | awk -F / '{print $1}')
export MY_APP=$(echo $(echo "${GITHUB_REPOSITORY}" | awk -F / '{print $2}')"-develop")
export DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
export BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
export COMMIT=$(echo "$SHA" | cut -c -7)

docker login -u "$DOCKER_ACTOR" -p "$DOCKER_TOKEN" docker.pkg.github.com
docker pull docker.pkg.github.com/"$MY_APP":"pr-""$PR"
docker tag docker.pkg.github.com/"$MY_APP":"pr-""$PR" docker.pkg.github.com/"$MY_APP":"latest"
docker push docker.pkg.github.com/"$MY_APP":"latest"
docker login -u "$DOCKER_ACTOR" -p "$DOCKER_TOKEN" ghcr.io
docker pull ghcr.io/"$MY_ORG"/"$MY_APP":"pr-""$PR"
docker tag ghcr.io/"$MY_ORG"/"$MY_APP":"pr-""$PR" ghcr.io/"$MY_ORG"/"$MY_APP":"latest"
docker push ghcr.io/"$MY_ORG"/"$MY_APP":"latest"
4 changes: 2 additions & 2 deletions .github/workflows/tag_environments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
uses: actions/checkout@v2
- name: Tag Deploy Environments
env:
DOCKER_ACTOR: ${{ github.actor }}
DOCKER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_ACTOR: jsfillman
DOCKER_TOKEN: ${{ secrets.GHCR_TOKEN }}
IMAGE_TAG: ${{ github.event.client_payload.image_tag }}
SHA: ${{ github.event.pull_request.head.sha }}
TARGET: ${{ github.event.client_payload.target }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tag_prod_latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ jobs:
env:
PR: "${{ github.event.pull_request.number }}"
SHA: "${{ github.event.pull_request.head.sha }}"
DOCKER_ACTOR: "${{ github.actor }}"
DOCKER_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
DOCKER_ACTOR: "jsfillman"
DOCKER_TOKEN: "${{ secrets.GHCR_TOKEN }}"
run: "./.github/workflows/scripts/tag_prod_latest.sh\n"
4 changes: 2 additions & 2 deletions .github/workflows/tag_test_latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ jobs:
env:
PR: "${{ github.event.pull_request.number }}"
SHA: "${{ github.event.pull_request.head.sha }}"
DOCKER_ACTOR: "${{ github.actor }}"
DOCKER_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
DOCKER_ACTOR: "jsfillman"
DOCKER_TOKEN: "${{ secrets.GHCR_TOKEN }}"
run: "./.github/workflows/scripts/tag_test_latest.sh\n"
68 changes: 68 additions & 0 deletions docs/adrs/0002-integration-testing-library.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Integration Testing Framework

Date: 2020-10-12

Integration testing and end-to-end (e2e) testing is not actively used in this repo. To implement integration/e2e testing, a testing framework needs to be selected and implemented.

## Author(s)

@eamahanna

## Status

Accepted

## Alternatives Considered

* WebDriver.io
* Cypress
* No integration testing

## Decision Outcome

Selenium WebDriver will be used for integration and e2e testing.

## Consequences

There will be overhead to create and maintain additional tests.

## Pros and Cons of the Alternatives

### Webdriver.io

* `+` Other repos in KBase use it
* `+` Has cross browser testing (Chrome, Firefox, Edge, IE, Opera, Safari)
* `+` Supports multiple languages
* `+` Supports iframes
* `-` Steep learning curve for new developers
* `-` Challenging to implement
* `-` Test execution is slow
* `-` Can be flaky

### Cypress

* `+` Easy to setup
* `+` Tests can be written quickly
* `+` Provides access to a dashboard for easy debugging
* `+` Small learning curve for new developers
* `+` Comprehensive documentation
* `+` Free for open source projects
* `-` Can only test using JavaScript
* `-` Has limited cross browser testing (Chrome, Edge, Electron, Firefox - Beta)
* `-` KBase developers will have to learn another testing framework
* `-` Limited iframe support (the narrative uses iframes in several locations)

### No integration/e2e testing

* `+` Will not take any time away from feature development
* `+` Less tests to maintain
* `-` Will not expand test coverage
* `-` Have low confindence during the development cycle
* `-` Will not have tests to catch integration bugs
* `-` Testing does not reflect the user expereience

## References

* [Cypress.io](https://www.cypress.io/)
* [WebDriver.io](https://webdriver.io/)
* [Applitools: Cypress vs Selenium WebDriver](https://applitools.com/blog/cypress-vs-selenium-webdriver-better-or-just-different/)
19 changes: 12 additions & 7 deletions docs/deploy_narrative.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This document describes how to release and deploy the Narrative Interface app onto the different KBase environments. It's intended for KBase developers and admins.

- Last modified: Sep. 25, 2020
- Last modified: Oct. 2, 2020

**_Table of Contents_**

Expand Down Expand Up @@ -43,7 +43,7 @@ The various KBase environments are all used used for slightly different purposes
6. Merge pull request.

Once a pull request is merged from a temporary branch to `develop` a new _development_ image will be available at:
`docker.pkg.github.com/kbase/narrative/narrative-develop:latest`. This is automatically deployed to CI.
`ghcr.io/kbase/narrative-develop:latest`. This is automatically deployed to CI.

To see your changes once the new image is created, simply open a narrative on CI. If you already have one loaded, restart the application by selecting the "Shutdown and Restart" option from the menu in the upper left.

Expand Down Expand Up @@ -73,14 +73,18 @@ To see your changes once the new image is created, simply open a narrative on CI

The [next](https://next.kbase.us), [appdev](https://appdev.kbase.us), and [prod](https://narrative.kbase.us) environments are all deployed using a production image.

### Deploying Narrative-Refactor

The [narrative-refactor](https://narrative-refactor.kbase.us) image is built against the "truss" branch of the repo and is called narrative-truss:pr### when still in a PR state or narrative-truss:latest after merge

#### Create Release Image

1. Create a new [pull request](https://github.com/kbase/narrative/compare) to merge the `develop` branch into `master`.
2. Ensure the automated tests complete successfully.
3. Complete the review and merge the PR.

Once a pull request is merged from `develop` to `master` a new _production_ image will be available at:
`docker.pkg.github.com/kbase/narrative/narrative:latest`.
`ghcr.io/kbase/narrative:latest`.

#### Tag & Deploy Image (admins only)

Expand All @@ -104,7 +108,8 @@ Once a pull request is merged from `develop` to `master` a new _production_ imag
| Environment | Image URL |
| ----------- | -------------------------------------------------------------- |
| CI | docker.pkg.github.com/kbase/narrative/narrative-develop:latest |
| Appdev | docker.pkg.github.com/kbase/narrative/narrative:appdev |
| Next | docker.pkg.github.com/kbase/narrative/narrative:next |
| Production | docker.pkg.github.com/kbase/narrative/narrative:prod |
| CI | ghcr.io/kbase/narrative-develop:latest |
| Narrative-refactor| ghcr.io/kbase/narrative-truss:latest |
| Appdev | ghcr.io/kbase/narrative:appdev |
| Next | ghcr.io/kbase/narrative:next |
| Production | ghcr.io/kbase/narrative:prod |
Loading

0 comments on commit 7b97c27

Please sign in to comment.