Skip to content

fix: handle spoke-portal being unreachable (#1675) #1606

fix: handle spoke-portal being unreachable (#1675)

fix: handle spoke-portal being unreachable (#1675) #1606

Workflow file for this run

name: CI/CD Pipeline
on:
push:
jobs:
hadolint:
runs-on: ubuntu-latest
name: "Hadolint"
steps:
- uses: actions/checkout@v2
- uses: jbergstroem/hadolint-gh-action@v1
with:
error_level: 0
dockerfile: "Dockerfile"
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- 16.14.0-buster
container:
image: node:${{ matrix.node-version }}
services:
postgres:
image: postgres:13.4
env:
POSTGRES_DB: spoke
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd "pg_isready -h localhost -p 5432"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
NODE_ENV: test
WEBPACK_HOST: "localhost"
WEBPACK_PORT: "3000"
DEV_APP_PORT: "8090"
BASE_URL: "localhost:3000"
SESSION_SECRET: "SuperSecret"
PHONE_NUMBER_COUNTRY: US
SUPPRESS_SELF_INVITE: "false"
JOBS_SAME_PROCESS: "1"
TEST_DATABASE_URL: "postgres://postgres:postgres@postgres:5432/spoke"
PASSPORT_STRATEGY: "local"
steps:
- name: checkout
uses: actions/checkout@v2
- uses: actions/cache@v2
id: yarn-cache
with:
path: node_modules
key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node-version }}-yarn-
- name: Install dependencies
run: yarn install
- name: Run codegen
run: yarn codegen:ts
- name: Lint Apps
run: yarn lint && yarn format
- name: Run migrations
run: yarn migrate:worker && yarn knex migrate:latest
- name: Run Tests
run: yarn jest --forceExit --detectOpenHandles src/**/*
publish-docker-image:
if: startsWith( github.ref, 'refs/tags/v')
needs: test
name: Publish Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
- name: Get image tags
id: image-tags
run: |
export GIT_SHA="${{ github.sha }}"
export GIT_SHA_SHORT=${GIT_SHA:0:7}
echo "::set-output name=sha::$GIT_SHA_SHORT"
export GIT_REF=${GITHUB_REF#refs/*/}
echo "$GIT_REF"
export SPOKE_VERSION=${GIT_REF#"v"}
export SPOKE_VERSION=${SPOKE_VERSION//[\/]/-}
echo "::set-output name=version::$SPOKE_VERSION"
- name: Login to GAR
uses: docker/login-action@v1
with:
registry: us-east4-docker.pkg.dev
username: _json_key
password: ${{ secrets.GCR_JSON_KEY }}
- name: Build and push Docker image
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
build-args: |
SPOKE_VERSION=${{ steps.image-tags.outputs.version }}
tags: |
us-east4-docker.pkg.dev/spoke-rewired/spoke/core:latest
us-east4-docker.pkg.dev/spoke-rewired/spoke/core:${{ steps.image-tags.outputs.version }}
us-east4-docker.pkg.dev/spoke-rewired/spoke/core:${{ steps.image-tags.outputs.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max