Skip to content

Commit

Permalink
Merge ef0a862 into 47466bb
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegn authored Oct 29, 2024
2 parents 47466bb + ef0a862 commit 6b446eb
Show file tree
Hide file tree
Showing 43 changed files with 580 additions and 220 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ permissions:

jobs:
release:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Checkout master branch
Expand All @@ -26,6 +27,7 @@ jobs:
DEFAULT_BUMP: "patch"

sync_docs:
if: github.ref == 'refs/heads/master'
needs: release
runs-on: ubuntu-latest
steps:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Install Go since pre-commit below runs "go mod tidy".
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
check-latest: true
# pre-commit runs "pip install" which doesn't work under Debian's apt-instaled Python.
# https://packaging.python.org/en/latest/specifications/externally-managed-environments/#externally-managed-environments
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- uses: pre-commit/[email protected]
with:
extra_args: --all-files --hook-stage=manual
Expand All @@ -40,5 +46,5 @@ jobs:
# check-latest: true
- uses: golangci/golangci-lint-action@v6
with:
version: v1.54
version: v1.61.0
working-directory: .
5 changes: 2 additions & 3 deletions .github/workflows/ci-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ concurrency:

jobs:
test:
uses:
./.github/workflows/test.yml
uses: ./.github/workflows/test.yml

# create a dev tag for every branch except master
tag_version:
Expand Down Expand Up @@ -68,7 +67,7 @@ jobs:
sha: context.sha
});
github-token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}
github-token: ${{ secrets.FLYIO_BUILDBOT_GITHUB_TOKEN }}

# # we can remove this workflow_call once the release.yml workflow file is
# # merged into the default branch
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/preflight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Preflight Tests
on:
workflow_dispatch:
inputs:
reason:
description: Brief reason for running this workflow manually
region:
description: Region
required: false
default: User initiated run
default: ord
type: string
workflow_call:

Expand All @@ -17,7 +17,6 @@ jobs:
strategy:
fail-fast: false
matrix:
vm_size: [""]
parallelism: [20]
index: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]
steps:
Expand All @@ -33,26 +32,27 @@ jobs:
run: |
curl -sfL https://raw.githubusercontent.com/Songmu/gotesplit/v0.2.1/install.sh | sh -s
echo "FLY_PREFLIGHT_TEST_APP_PREFIX=pf-gha-$(openssl rand -hex 4)" >> "$GITHUB_ENV"
# If this workflow is triggered by code changes (eg PRs), download the binary to save time.
- uses: actions/download-artifact@v4
with:
name: flyctl
path: master-build
- name: Move flyctl binary to correct directory
run: |
mv master-build/flyctl bin/flyctl
chmod +x bin/flyctl
continue-on-error: true
# But if this is a manual run, build the binary first.
- run: make
- name: Run preflight tests
id: preflight
env:
FLY_PREFLIGHT_TEST_ACCESS_TOKEN: ${{ secrets.FLYCTL_PREFLIGHT_CI_FLY_API_TOKEN }}
FLY_PREFLIGHT_TEST_FLY_ORG: flyctl-ci-preflight
# This VM size is only available in ORD.
FLY_PREFLIGHT_TEST_FLY_REGIONS: ord
FLY_PREFLIGHT_TEST_FLY_REGIONS: ${{ inputs.region }}
FLY_PREFLIGHT_TEST_NO_PRINT_HISTORY_ON_FAIL: "true"
FLY_FORCE_TRACE: "true"
FLY_PREFLIGHT_TEST_VM_SIZE: ${{ matrix.vm_size }}
FLY_PREFLIGHT_TEST_APP_PREFIX: "preflight"
run: |
(test -e master-build/flyctl) && mv master-build/flyctl bin/flyctl
chmod +x bin/flyctl
export PATH=$PWD/bin:$PATH
echo -n failed= >> $GITHUB_OUTPUT
./scripts/preflight.sh -r "${{ github.ref }}" -t "${{ matrix.parallelism }}" -i "${{ matrix.index }}" -o $GITHUB_OUTPUT
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/preflight_cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Preflight Tests Cleanup

on:
schedule:
- cron: '*/30 * * * *'
- cron: "*/30 * * * *"
workflow_dispatch:
inputs:
reason:
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:

permissions:
contents: write
packages: write

# concurrency:
# group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -81,6 +82,17 @@ jobs:
with:
path: dist/${{ matrix.GOOS }}
key: ${{ matrix.GOOS }}-${{ needs.meta.outputs.sha_short }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.FLYIOBUILDS_DOCKERHUB_USERNAME }}
password: ${{ secrets.FLYIOBUILDS_DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser
if: steps.cache.outputs.cache-hit != 'true' # do not run if cache hit
uses: goreleaser/goreleaser-action@v5
Expand Down
10 changes: 10 additions & 0 deletions .goreleaser.2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,15 @@ archives:
wrap_in_directory: false
format: zip

dockers:
- goos: linux
goarch: amd64
image_templates:
- "flyio/flyctl:latest"
- "flyio/flyctl:v{{ .Version }}"
- "ghcr.io/superfly/flyctl:latest"
- "ghcr.io/superfly/flyctl:v{{ .Version }}"
skip_push: auto

release:
disable: false
16 changes: 9 additions & 7 deletions deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

begin

Signal.trap('INT') do
event :cancel, { signal: "SIGINT" }
exit 0
end

event :start, { ts: ts() }

# Change to a directory where we'll pull on git
Expand Down Expand Up @@ -76,7 +81,7 @@
in_step Step::GIT_PULL do
ref = get_env("GIT_REF")
artifact Artifact::GIT_INFO, { repository: GIT_REPO, reference: ref }

exec_capture("git init", log: false)

redacted_repo_url = GIT_REPO_URL.dup
Expand Down Expand Up @@ -118,10 +123,7 @@
""
end

if DEPLOY_ONLY
event :error, {type: :validation, message: "missing fly.toml" } if !HAS_FLY_CONFIG
exit 1
else
if !DEPLOY_ONLY
MANIFEST_PATH = "/tmp/manifest.json"

manifest = in_step Step::PLAN do
Expand Down Expand Up @@ -202,7 +204,7 @@
plugin = FLYCTL_TO_ASDF_PLUGIN_NAME.fetch(RUNTIME_LANGUAGE, RUNTIME_LANGUAGE)
if plugin == "elixir"
# required for elixir to work
exec_capture("asdf install erlang #{DEFAULT_ERLANG_VERSION}")
exec_capture("asdf install erlang #{DEFAULT_ERLANG_VERSION}")
end
exec_capture("asdf install #{plugin} #{version}")
else
Expand Down Expand Up @@ -445,4 +447,4 @@
$stderr.flush

sleep 1.0
end
end
3 changes: 2 additions & 1 deletion deployer.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ RUN git clone https://github.com/asdf-vm/asdf.git $HOME/.asdf --branch v0.14.0 &
asdf install erlang $DEFAULT_ERLANG_VERSION && asdf global erlang $DEFAULT_ERLANG_VERSION && \
asdf install elixir $DEFAULT_ELIXIR_VERSION && asdf global elixir $DEFAULT_ELIXIR_VERSION && \
# bun
asdf plugin add bun https://github.com/cometkim/asdf-bun.git
asdf plugin add bun https://github.com/cometkim/asdf-bun.git && \
asdf install bun $DEFAULT_BUN_VERSION && asdf global bun $DEFAULT_BUN_VERSION

ENV MIX_ENV=dev

Expand Down
4 changes: 4 additions & 0 deletions doc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ func main() {
cmd := cli.NewRootCommand()
cmd.DisableAutoGenTag = true

// Override root command to always be `fly`,
// Otherwise it could be `main`, `flyctl` or whatever name is set to the executable
cmd.Use = "fly"

filePrepender := func(filename string) string {
return ""
}
Expand Down
5 changes: 3 additions & 2 deletions flypg/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/base64"
"encoding/json"
"errors"
"fmt"

fly "github.com/superfly/fly-go"
Expand Down Expand Up @@ -73,7 +74,7 @@ func (pc *Command) UpdateSettings(ctx context.Context, leaderIp string, config m
}

if !result.Success {
return fmt.Errorf(result.Message)
return errors.New(result.Message)
}

return nil
Expand All @@ -94,7 +95,7 @@ func (pc *Command) UnregisterMember(ctx context.Context, leaderIP string, standb
}

if !result.Success {
return fmt.Errorf(result.Message)
return errors.New(result.Message)
}

return nil
Expand Down
Loading

0 comments on commit 6b446eb

Please sign in to comment.