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

feat(cmd/flipt-edge): lean, mean flag evaluating machine #3491

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
74 changes: 74 additions & 0 deletions .github/workflows/edge-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Release Edge (Nightly)
on:
workflow_dispatch:
schedule:
- cron: "45 22 * * *" # nightly @ 10:45 PM UTC

permissions:
contents: write
packages: write

env:
GO_VERSION: "1.22"

jobs:
nightly-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: true

- uses: docker/setup-qemu-action@v3

- uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: "${{ github.repository_owner }}"
password: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/cache@v4
with:
path: _tools/
key: ${{ runner.os }}-go-tools${{ hashFiles('_tools/go.sum') }}
restore-keys: |
${{ runner.os }}-go-tools-

- name: Install GCC for arm64
run: |
sudo apt-get update && \
sudo apt-get install -y gcc-aarch64-linux-gnu

- name: Install Syft
run: |
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin

- name: Git Tag
run: |
echo "GORELEASER_CURRENT_TAG=$(git describe --tags --match='v[0-9]*' `git rev-list --tags --max-count=1`)" >> $GITHUB_ENV

- name: GoReleaser Edge (Nightly) Build
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser-pro
version: latest
args: release --clean --nightly -f .goreleaser.edge.yml
env:
GORELEASER_CURRENT_TAG: ${{ env.GORELEASER_CURRENT_TAG }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48 changes: 0 additions & 48 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,12 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Free Disk Space
uses: jlumbroso/[email protected]
with:
# Runs quick, run rm in background
tool-cache: true

# These run slower as use apt to uninstall packages
# Turned on by default, so we disable them
android: false
dotnet: false
haskell: false
large-packages: false
docker-images: false
swap-storage: false

- name: Run CLI Tests
uses: dagger/dagger-for-github@v6
with:
verb: call
version: ${{ env.DAGGER_VERSION }}
args: test --source .:default cli
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}

test:
name: Integration Tests
Expand Down Expand Up @@ -79,21 +63,6 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Free Disk Space
uses: jlumbroso/[email protected]
with:
# Runs quick, run rm in background
tool-cache: true

# These run slower as use apt to uninstall packages
# Turned on by default, so we disable them
android: false
dotnet: false
haskell: false
large-packages: false
docker-images: false
swap-storage: false

- run: echo "INTEGRATION_TEST_NAME=${{ matrix.test }}" | tr '/' '-' >> $GITHUB_ENV

- name: Run Integration Tests
Expand All @@ -102,7 +71,6 @@ jobs:
verb: call
version: ${{ env.DAGGER_VERSION }}
args: test --source .:default integration --cases ${{ matrix.test }}
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}

- name: Upload Flipt Service Logs
uses: actions/upload-artifact@v4
Expand All @@ -120,25 +88,9 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Free Disk Space
uses: jlumbroso/[email protected]
with:
# Runs quick, run rm in background
tool-cache: true

# These run slower as use apt to uninstall packages
# Turned on by default, so we disable them
android: false
dotnet: false
haskell: false
large-packages: false
docker-images: false
swap-storage: false

- name: Run UI Tests
uses: dagger/dagger-for-github@v6
with:
verb: call
version: ${{ env.DAGGER_VERSION }}
args: test --source .:default ui
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i decided to remove Dagger Cloud because im not sure we're benefiting too much from it and I also don't think this free-disk-space action works incredibly well. The disk space usage is caused by Dagger Cloud downloading the entire cache history (I think) on run, which both slows down CI and blows up our disk.

2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permissions:
packages: write

env:
GO_VERSION: "1.21"
GO_VERSION: "1.22"

jobs:
nightly-build:
Expand Down
32 changes: 0 additions & 32 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,12 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Free Disk Space
uses: jlumbroso/[email protected]
with:
# Runs quick, run rm in background
tool-cache: true

# These run slower as use apt to uninstall packages
# Turned on by default, so we disable them
android: false
dotnet: false
haskell: false
large-packages: false
docker-images: false
swap-storage: false

- name: Run Unit Tests
uses: dagger/dagger-for-github@v6
with:
verb: call
version: ${{ env.DAGGER_VERSION }}
args: test --source .:default unit export --path coverage.txt
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}

- name: Upload Coverage
uses: codecov/[email protected]
Expand Down Expand Up @@ -93,25 +77,9 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Free Disk Space
uses: jlumbroso/[email protected]
with:
# Runs quick, run rm in background
tool-cache: true

# These run slower as use apt to uninstall packages
# Turned on by default, so we disable them
android: false
dotnet: false
haskell: false
large-packages: false
docker-images: false
swap-storage: false

- name: Run Migration Tests
uses: dagger/dagger-for-github@v6
with:
verb: call
version: ${{ env.DAGGER_VERSION }}
args: test --source .:default migration
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
85 changes: 85 additions & 0 deletions .goreleaser.edge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json
version: 2

project_name: flipt-edge

git:
tag_sort: semver

monorepo:
tag_prefix: v

builds:
- main: ./cmd/flipt-edge/.
ldflags:
- -s -w
- -X main.version={{ .PrefixedTag }}
- -X main.commit={{ .Commit }}
- -X main.date={{ .Date }}
- -linkmode external -extldflags "-static"
goos:
- linux
goarch:
- amd64
- arm64
flags:
- -tags=netgo
- -trimpath
overrides:
- goos: linux
goarch: amd64
goamd64: v1
env:
- CGO_ENABLED=1
- CC=x86_64-linux-gnu-gcc

- goos: linux
goarch: arm64
env:
- CGO_ENABLED=1
- CC=aarch64-linux-gnu-gcc

changelog:
disable: true

dockers:
- dockerfile: ./build/Dockerfile.edge
use: buildx
goos: linux
goarch: amd64
image_templates:
- "{{ if .IsNightly }}flipt/flipt-edge:v{{ incpatch .Version }}-nightly-amd64{{ else }}flipt/flipt-edge:v{{ .Tag }}-amd64{{ end }}"
- "{{ if .IsNightly }}ghcr.io/flipt-io/flipt-edge:v{{ incpatch .Version }}-nightly-amd64{{ else }}ghcr.io/flipt-io/flipt-edge:v{{ .Tag }}-amd64{{ end }}"
build_flag_templates:
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
extra_files:
- config/default.yml

- dockerfile: ./build/Dockerfile.edge
use: buildx
goos: linux
goarch: arm64
image_templates:
- "{{ if .IsNightly }}flipt/flipt-edge:v{{ incpatch .Version }}-nightly-arm64{{ else }}flipt/flipt-edge:v{{ .Tag }}-arm64{{ end }}"
- "{{ if .IsNightly }}ghcr.io/flipt-io/flipt-edge:v{{ incpatch .Version }}-nightly-arm64{{ else }}ghcr.io/flipt-io/flipt-edge:v{{ .Tag }}-arm64{{ end }}"
build_flag_templates:
- "--platform=linux/arm64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
extra_files:
- config/default.yml

docker_manifests:
- name_template: "{{ if .IsNightly }}flipt/flipt-edge:v{{ incpatch .Version }}-nightly{{ else }}flipt/flipt-edge:v{{ .Tag }}{{ end }}"
image_templates:
- "{{ if .IsNightly }}flipt/flipt-edge:v{{ incpatch .Version }}-nightly-amd64{{ else }}flipt/flipt-edge:v{{ .Tag }}-amd64{{ end }}"
- "{{ if .IsNightly }}flipt/flipt-edge:v{{ incpatch .Version }}-nightly-arm64{{ else }}flipt/flipt-edge:v{{ .Tag }}-arm64{{ end }}"

- name_template: "{{ if .IsNightly }}ghcr.io/flipt-io/flipt-edge:v{{ incpatch .Version }}-nightly{{ else }}ghcr.io/flipt-io/flipt-edge:v{{ .Tag }}{{ end }}"
image_templates:
- "{{ if .IsNightly }}ghcr.io/flipt-io/flipt-edge:v{{ incpatch .Version }}-nightly-amd64{{ else }}ghcr.io/flipt-io/flipt-edge:v{{ .Tag }}-amd64{{ end }}"
- "{{ if .IsNightly }}ghcr.io/flipt-io/flipt-edge:v{{ incpatch .Version }}-nightly-arm64{{ else }}ghcr.io/flipt-io/flipt-edge:v{{ .Tag }}-arm64{{ end }}"
Loading
Loading