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

Make the time-to-deploy 2x quicker: 2mins vs 4mins #522

Merged
merged 1 commit into from
Sep 1, 2024
Merged
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
90 changes: 0 additions & 90 deletions .github/workflows/dagger_on_fly.yml

This file was deleted.

52 changes: 52 additions & 0 deletions .github/workflows/dagger_on_namespace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: "Dagger on Namespace"

on:
workflow_call:

jobs:
run:
runs-on: namespace-profile-changelog
steps:
- name: "Checkout code..."
uses: namespacelabs/nscloud-checkout-action@v5

- uses: actions/setup-go@v5
with:
go-version: "1.20"
cache-dependency-path: "magefiles/go.sum"

- name: "Provision Dagger with local cache"
run: |
docker run \
--name dagger-0-6-4 \
--detach --restart always \
--volume /cache/dagger-0-6-4:/var/lib/dagger \
--privileged \
registry.dagger.io/engine:v0.6.4

- name: "Build, test, publish & deploy..."
env:
IMAGE_OWNER: "${{ vars.IMAGE_OWNER }}"
GHCR_USERNAME: "${{ github.actor }}"
GHCR_PASSWORD: "${{ secrets.GHCR_PASSWORD }}"
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
R2_API_HOST: "${{ secrets.R2_API_HOST }}"
R2_ACCESS_KEY_ID: "${{ secrets.R2_ACCESS_KEY_ID }}"
R2_SECRET_ACCESS_KEY: "${{ secrets.R2_SECRET_ACCESS_KEY }}"
R2_ASSETS_BUCKET: "${{ env.R2_ASSETS_BUCKET }}"
OBAN_KEY_FINGERPRINT: "${{ secrets.OBAN_KEY_FINGERPRINT }}"
OBAN_LICENSE_KEY: "${{ secrets.OBAN_LICENSE_KEY }}"
_EXPERIMENTAL_DAGGER_RUNNER_HOST: "docker-container://dagger-0-6-4"
run: |
cd magefiles
go run main.go -w ../ ci cd

- name: "Announce deploy in #dev Slack..."
if: ${{ github.repository == 'thechangelog/changelog.com' && github.ref_name == 'master' }}
uses: rtCamp/action-slack-notify@v2
env:
MSG_MINIMAL: "commit,actions url"
SLACK_CHANNEL: dev
SLACK_USERNAME: "GitHub Actions"
SLACK_FOOTER: "Just got shipped to https://changelog.com"
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
25 changes: 13 additions & 12 deletions .github/workflows/ship_it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,29 @@ on:
jobs:
# In thechangelog/changelog repository (a.k.a. upstream),
# this is the preferred default:
dagger-on-fly:
if: ${{ contains(vars.RUNS_ON, 'fly') }}
uses: ./.github/workflows/dagger_on_fly.yml
dagger-on-namespace:
if: ${{ contains(vars.RUNS_ON, 'namespace') }}
uses: ./.github/workflows/dagger_on_namespace.yml
secrets: inherit

# When our Fly.io setup misbehaves, we want a fallback:
# Just in case Namespace.so misbehaves, we want a fallback:
# a.k.a. "Always run 2 of everything"
dagger-on-github-fallback:
needs: dagger-on-fly
needs: dagger-on-namespace
if: ${{ failure() }}
uses: ./.github/workflows/dagger_on_github.yml
secrets: inherit

# As forks will not have access to our Fly.io,
# we fallback to GitHub default:
dagger-on-github:
if: ${{ !contains(vars.RUNS_ON, 'fly') }}
uses: ./.github/workflows/dagger_on_github.yml
secrets: inherit

# This is an experimental job which only runs the CI part of our pipeline.
# In other words, this does not run CD, it does not deploy our app.
dagger-on-k8s:
if: ${{ contains(vars.RUNS_ON, 'k8s') }}
uses: ./.github/workflows/dagger_on_k8s.yml
secrets: inherit

# As forks will not have access to our Namespace.so,
# we fallback to GitHub default:
dagger-on-github:
if: ${{ !contains(vars.RUNS_ON, 'namespace') }}
uses: ./.github/workflows/dagger_on_github.yml
secrets: inherit
Loading