chore: fix deployment workflows

This commit is contained in:
Karol Sójko 2023-02-07 11:18:43 +01:00
parent f11569ac53
commit b0e31ff305
No known key found for this signature in database
GPG key ID: D966F68E8A92F649
13 changed files with 28 additions and 365 deletions

View file

@ -11,9 +11,9 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
call_server_utility_workflow: call_server_application_workflow:
name: Server Utility name: Server Application
uses: standardnotes/server/.github/workflows/common-server-utility.yml@main uses: standardnotes/server/.github/workflows/common-server-application.yml@main
with: with:
service_name: analytics service_name: analytics
workspace_name: "@standardnotes/analytics" workspace_name: "@standardnotes/analytics"
@ -22,7 +22,7 @@ jobs:
secrets: inherit secrets: inherit
newrelic: newrelic:
needs: call_server_utility_workflow needs: call_server_application_workflow
runs-on: ubuntu-latest runs-on: ubuntu-latest

View file

@ -17,7 +17,6 @@ jobs:
with: with:
service_name: api-gateway service_name: api-gateway
workspace_name: "@standardnotes/api-gateway" workspace_name: "@standardnotes/api-gateway"
e2e_tag_parameter_name: api_gateway_image_tag
deploy_worker: false deploy_worker: false
package_path: packages/api-gateway package_path: packages/api-gateway
secrets: inherit secrets: inherit

View file

@ -17,7 +17,6 @@ jobs:
with: with:
service_name: auth service_name: auth
workspace_name: "@standardnotes/auth-server" workspace_name: "@standardnotes/auth-server"
e2e_tag_parameter_name: auth_image_tag
package_path: packages/auth package_path: packages/auth
secrets: inherit secrets: inherit

View file

@ -6,9 +6,6 @@ on:
service_name: service_name:
required: true required: true
type: string type: string
bundle_dir:
required: true
type: string
package_path: package_path:
required: true required: true
type: string type: string
@ -32,13 +29,17 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Create Bundle Dir
id: bundle-dir
run: echo "temp_dir=$(mktemp -d -t ${{ inputs.service_name }}-${{ github.sha }}-XXXXXXX)" >> $GITHUB_OUTPUT
- name: Cache build - name: Cache build
id: cache-build id: cache-build
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: | path: |
packages/**/dist packages/**/dist
${{ inputs.bundle_dir }} ${{ steps.bundle-dir.outputs.temp_dir }}
key: ${{ runner.os }}-${{ inputs.service_name }}-build-${{ github.sha }} key: ${{ runner.os }}-${{ inputs.service_name }}-build-${{ github.sha }}
- name: Set up Node - name: Set up Node
@ -53,7 +54,7 @@ jobs:
- name: Bundle - name: Bundle
if: steps.cache-build.outputs.cache-hit != 'true' if: steps.cache-build.outputs.cache-hit != 'true'
run: yarn workspace ${{ inputs.workspace_name }} bundle --no-compress --output-directory ${{ inputs.bundle_dir }} run: yarn workspace ${{ inputs.workspace_name }} bundle --no-compress --output-directory ${{ steps.bundle-dir.outputs.temp_dir }}
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v2 uses: docker/login-action@v2
@ -85,8 +86,8 @@ jobs:
uses: docker/build-push-action@v3 uses: docker/build-push-action@v3
with: with:
builder: ${{ steps.buildx.outputs.name }} builder: ${{ steps.buildx.outputs.name }}
context: ${{ inputs.bundle_dir }} context: ${{ steps.bundle-dir.outputs.temp_dir }}
file: ${{ inputs.bundle_dir }}/${{ inputs.package_path }}/Dockerfile file: ${{ steps.bundle-dir.outputs.temp_dir }}/${{ inputs.package_path }}/Dockerfile
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
push: true push: true
tags: | tags: |

View file

@ -17,9 +17,6 @@ on:
required: false required: false
default: true default: true
type: boolean type: boolean
e2e_tag_parameter_name:
required: false
type: string
package_path: package_path:
required: true required: true
type: string type: string
@ -36,177 +33,11 @@ on:
required: true required: true
jobs: jobs:
build:
runs-on: ubuntu-latest
outputs:
temp_dir: ${{ steps.bundle-dir.outputs.temp_dir }}
steps:
- uses: actions/checkout@v3
- name: Create Bundle Dir
id: bundle-dir
run: echo "temp_dir=$(mktemp -d -t ${{ inputs.service_name }}-${{ github.sha }}-XXXXXXX)" >> $GITHUB_OUTPUT
- name: Cache build
id: cache-build
uses: actions/cache@v3
with:
path: |
packages/**/dist
${{ steps.bundle-dir.outputs.temp_dir }}
key: ${{ runner.os }}-${{ inputs.service_name }}-build-${{ github.sha }}
- name: Set up Node
uses: actions/setup-node@v3
with:
registry-url: 'https://registry.npmjs.org'
node-version-file: '.nvmrc'
- name: Build
run: yarn build ${{ inputs.package_path }}
- name: Bundle
run: yarn workspace ${{ inputs.workspace_name }} bundle --no-compress --output-directory ${{ steps.bundle-dir.outputs.temp_dir }}
lint:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: Cache build
id: cache-build
uses: actions/cache@v3
with:
path: |
packages/**/dist
${{ needs.build.outputs.temp_dir }}
key: ${{ runner.os }}-${{ inputs.service_name }}-build-${{ github.sha }}
- name: Set up Node
uses: actions/setup-node@v3
with:
registry-url: 'https://registry.npmjs.org'
node-version-file: '.nvmrc'
- name: Build
if: steps.cache-build.outputs.cache-hit != 'true'
run: yarn build ${{ inputs.package_path }}
- name: Lint
run: yarn lint:${{ inputs.service_name }}
test:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: Cache build
id: cache-build
uses: actions/cache@v3
with:
path: |
packages/**/dist
${{ needs.build.outputs.temp_dir }}
key: ${{ runner.os }}-${{ inputs.service_name }}-build-${{ github.sha }}
- name: Set up Node
uses: actions/setup-node@v3
with:
registry-url: 'https://registry.npmjs.org'
node-version-file: '.nvmrc'
- name: Build
if: steps.cache-build.outputs.cache-hit != 'true'
run: yarn build ${{ inputs.package_path }}
- name: Test
run: yarn test ${{ inputs.package_path }}
e2e:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: Cache build
id: cache-build
uses: actions/cache@v3
with:
path: |
packages/**/dist
${{ needs.build.outputs.temp_dir }}
key: ${{ runner.os }}-${{ inputs.service_name }}-build-${{ github.sha }}
- name: Set up Node
uses: actions/setup-node@v3
with:
registry-url: 'https://registry.npmjs.org'
node-version-file: '.nvmrc'
- name: Build
if: steps.cache-build.outputs.cache-hit != 'true'
run: yarn build ${{ inputs.package_path }}
- name: Bundle
if: steps.cache-build.outputs.cache-hit != 'true'
run: yarn workspace ${{ inputs.workspace_name }} bundle --no-compress --output-directory ${{ needs.build.outputs.temp_dir }}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Publish Docker image for E2E testing
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
context: ${{ needs.build.outputs.temp_dir }}
file: ${{ needs.build.outputs.temp_dir }}/${{ inputs.package_path }}/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: standardnotes/${{ inputs.service_name }}:${{ github.sha }}
- name: Run E2E test suite
uses: convictional/trigger-workflow-and-wait@master
with:
owner: standardnotes
repo: self-hosted
github_token: ${{ secrets.CI_PAT_TOKEN }}
workflow_file_name: testing-with-updating-client-and-server.yml
wait_interval: 30
client_payload: '{"${{ inputs.e2e_tag_parameter_name }}": "${{ github.sha }}"}'
propagate_failure: true
trigger_workflow: true
wait_workflow: true
publish: publish:
needs: [ build, test, lint, e2e ]
name: Publish Docker Image name: Publish Docker Image
uses: standardnotes/server/.github/workflows/common-docker-image.yml@main uses: standardnotes/server/.github/workflows/common-docker-image.yml@main
with: with:
service_name: ${{ inputs.service_name }} service_name: ${{ inputs.service_name }}
bundle_dir: ${{ needs.build.outputs.temp_dir }}
package_path: ${{ inputs.package_path }} package_path: ${{ inputs.package_path }}
workspace_name: ${{ inputs.workspace_name }} workspace_name: ${{ inputs.workspace_name }}
secrets: inherit secrets: inherit

View file

@ -1,164 +0,0 @@
name: Reusable Server Utility Workflow
on:
workflow_call:
inputs:
service_name:
required: true
type: string
workspace_name:
required: true
type: string
deploy_web:
required: false
default: true
type: boolean
deploy_worker:
required: false
default: true
type: boolean
package_path:
required: true
type: string
secrets:
DOCKER_USERNAME:
required: true
DOCKER_PASSWORD:
required: true
CI_PAT_TOKEN:
required: true
AWS_ACCESS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true
jobs:
build:
runs-on: ubuntu-latest
outputs:
temp_dir: ${{ steps.bundle-dir.outputs.temp_dir }}
steps:
- uses: actions/checkout@v3
- name: Create Bundle Dir
id: bundle-dir
run: echo "temp_dir=$(mktemp -d -t ${{ inputs.service_name }}-${{ github.sha }}-XXXXXXX)" >> $GITHUB_OUTPUT
- name: Cache build
id: cache-build
uses: actions/cache@v3
with:
path: |
packages/**/dist
${{ steps.bundle-dir.outputs.temp_dir }}
key: ${{ runner.os }}-${{ inputs.service_name }}-build-${{ github.sha }}
- name: Set up Node
uses: actions/setup-node@v3
with:
registry-url: 'https://registry.npmjs.org'
node-version-file: '.nvmrc'
- name: Build
run: yarn build ${{ inputs.package_path }}
- name: Bundle
run: yarn workspace ${{ inputs.workspace_name }} bundle --no-compress --output-directory ${{ steps.bundle-dir.outputs.temp_dir }}
lint:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: Cache build
id: cache-build
uses: actions/cache@v3
with:
path: |
packages/**/dist
${{ needs.build.outputs.temp_dir }}
key: ${{ runner.os }}-${{ inputs.service_name }}-build-${{ github.sha }}
- name: Set up Node
uses: actions/setup-node@v3
with:
registry-url: 'https://registry.npmjs.org'
node-version-file: '.nvmrc'
- name: Build
if: steps.cache-build.outputs.cache-hit != 'true'
run: yarn build ${{ inputs.package_path }}
- name: Lint
run: yarn lint:${{ inputs.service_name }}
test:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: Cache build
id: cache-build
uses: actions/cache@v3
with:
path: |
packages/**/dist
${{ needs.build.outputs.temp_dir }}
key: ${{ runner.os }}-${{ inputs.service_name }}-build-${{ github.sha }}
- name: Set up Node
uses: actions/setup-node@v3
with:
registry-url: 'https://registry.npmjs.org'
node-version-file: '.nvmrc'
- name: Build
if: steps.cache-build.outputs.cache-hit != 'true'
run: yarn build ${{ inputs.package_path }}
- name: Test
run: yarn test ${{ inputs.package_path }}
publish:
needs: [ build, test, lint ]
name: Publish Docker Image
uses: standardnotes/server/.github/workflows/common-docker-image.yml@main
with:
service_name: ${{ inputs.service_name }}
bundle_dir: ${{ needs.build.outputs.temp_dir }}
package_path: ${{ inputs.package_path }}
workspace_name: ${{ inputs.workspace_name }}
secrets: inherit
deploy-web:
if: ${{ inputs.deploy_web }}
needs: publish
name: Deploy Web
uses: standardnotes/server/.github/workflows/common-deploy.yml@main
with:
service_name: ${{ inputs.service_name }}
docker_image: ${{ inputs.service_name }}:${{ github.sha }}
secrets: inherit
deploy-worker:
if: ${{ inputs.deploy_worker }}
needs: publish
name: Deploy Worker
uses: standardnotes/server/.github/workflows/common-deploy.yml@main
with:
service_name: ${{ inputs.service_name }}-worker
docker_image: ${{ inputs.service_name }}:${{ github.sha }}
secrets: inherit

View file

@ -11,9 +11,9 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
call_server_utility_workflow: call_server_application_workflow:
name: Server Utility name: Server Application
uses: standardnotes/server/.github/workflows/common-server-utility.yml@main uses: standardnotes/server/.github/workflows/common-server-application.yml@main
with: with:
service_name: event-store service_name: event-store
workspace_name: "@standardnotes/event-store" workspace_name: "@standardnotes/event-store"
@ -22,7 +22,7 @@ jobs:
secrets: inherit secrets: inherit
newrelic: newrelic:
needs: call_server_utility_workflow needs: call_server_application_workflow
runs-on: ubuntu-latest runs-on: ubuntu-latest

View file

@ -17,7 +17,6 @@ jobs:
with: with:
service_name: files service_name: files
workspace_name: "@standardnotes/files-server" workspace_name: "@standardnotes/files-server"
e2e_tag_parameter_name: files_image_tag
package_path: packages/files package_path: packages/files
secrets: inherit secrets: inherit

View file

@ -17,7 +17,6 @@ jobs:
with: with:
service_name: revisions service_name: revisions
workspace_name: "@standardnotes/revisions-server" workspace_name: "@standardnotes/revisions-server"
e2e_tag_parameter_name: revisions_image_tag
package_path: packages/revisions package_path: packages/revisions
secrets: inherit secrets: inherit

View file

@ -11,9 +11,9 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
call_server_utility_workflow: call_server_application_workflow:
name: Server Utility name: Server Application
uses: standardnotes/server/.github/workflows/common-server-utility.yml@main uses: standardnotes/server/.github/workflows/common-server-application.yml@main
with: with:
service_name: scheduler service_name: scheduler
workspace_name: "@standardnotes/scheduler-server" workspace_name: "@standardnotes/scheduler-server"
@ -22,7 +22,7 @@ jobs:
secrets: inherit secrets: inherit
newrelic: newrelic:
needs: call_server_utility_workflow needs: call_server_application_workflow
runs-on: ubuntu-latest runs-on: ubuntu-latest

View file

@ -17,7 +17,6 @@ jobs:
with: with:
service_name: syncing-server-js service_name: syncing-server-js
workspace_name: "@standardnotes/syncing-server" workspace_name: "@standardnotes/syncing-server"
e2e_tag_parameter_name: syncing_server_js_image_tag
package_path: packages/syncing-server package_path: packages/syncing-server
secrets: inherit secrets: inherit

View file

@ -11,9 +11,9 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
call_server_utility_workflow: call_server_application_workflow:
name: Server Utility name: Server Application
uses: standardnotes/server/.github/workflows/common-server-utility.yml@main uses: standardnotes/server/.github/workflows/common-server-application.yml@main
with: with:
service_name: websockets service_name: websockets
workspace_name: "@standardnotes/websockets-server" workspace_name: "@standardnotes/websockets-server"
@ -21,7 +21,7 @@ jobs:
secrets: inherit secrets: inherit
newrelic: newrelic:
needs: call_server_utility_workflow needs: call_server_application_workflow
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:

View file

@ -11,9 +11,9 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
call_server_utility_workflow: call_server_application_workflow:
name: Server Utility name: Server Application
uses: standardnotes/server/.github/workflows/common-server-utility.yml@main uses: standardnotes/server/.github/workflows/common-server-application.yml@main
with: with:
service_name: workspace service_name: workspace
workspace_name: "@standardnotes/workspace-server" workspace_name: "@standardnotes/workspace-server"
@ -21,7 +21,7 @@ jobs:
secrets: inherit secrets: inherit
newrelic: newrelic:
needs: call_server_utility_workflow needs: call_server_application_workflow
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps: