Skip to content

Commit

Permalink
chore: fix screenshots script; update readme some; add go sdk license (
Browse files Browse the repository at this point in the history
  • Loading branch information
markphelps authored Oct 4, 2023
1 parent 08e8450 commit b4e6e64
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 65 deletions.
Binary file added .github/images/console-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .github/images/console.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed .github/images/darkmode.png
Binary file not shown.
Binary file modified .github/images/flags.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,21 @@ Flipt supports use cases such as:
- Ability to create advanced distribution rules to target segments of users
- Native [GRPC](https://grpc.io/) client [SDKs](#grpc-client-libraries) to integrate with your existing GRPC architecture
- Powerful REST API with native [SDKs](#rest-client-libraries) for easy integration
- Modern, mobile-friendly 📱 UI and debug console
- Dark mode 🌙
- Modern, mobile-friendly 📱 UI and debug console with dark mode 🌙
- Supports multiple databases: Postgres, MySQL, SQLite, CockroachDB
- Import and export to allow storing your data as code
- Cloud-ready :cloud:. Runs anywhere: bare metal, PaaS, K8s, with Docker or without
- Works with [Prometheus](https://prometheus.io/) and [OpenTelemetry](https://opentelemetry.io/) out of the box
- [Filesystem, S3, and Git storage backends](https://www.flipt.io/docs/experimental/filesystem-backends)
- Audit logging to track changes to your data
- Cloud-ready. Runs anywhere: bare metal, PaaS, K8s, with Docker or without
- Works with [Prometheus](https://prometheus.io/) and [OpenTelemetry](https://opentelemetry.io/) out of the box 🔋
- [Filesystem, S3, and Git storage backends](https://www.flipt.io/docs/configuration/storage#filesystem) to support GitOps workflows
- Audit logging with webhooks support to track changes to your data

Are we missing a feature that you'd like to see? [Let us know!](https://features.flipt.io)

<br clear="both"/>

<div align="center">
<img align="left" src=".github/images/console.png" alt="Flipt Console" width=45% />
<img align="right" src=".github/images/darkmode.png" alt="Dark Theme" width=45% />
<img align="right" src=".github/images/console-dark.png" alt="Flipt Console - Dark" width=45% />
</div>

<br clear="both"/>
Expand Down Expand Up @@ -180,6 +179,15 @@ docker run --rm -p 8080:8080 -p 9000:9000 -t flipt/flipt:nightly

<br clear="both"/>

## Release Cadence

Flipt follows [semantic versioning](https://semver.org/) for versioning.

We aim to release a new minor version of Flipt every 2-3 weeks. This allows us to quickly iterate on new features.
Bug fixes and security patches (patch versions) will be released as needed.

<br clear="both"/>

## Integration

Check out the [integration documentation](https://flipt.io/docs/integration/) for more info on how to integrate Flipt into your existing applications.
Expand Down Expand Up @@ -251,7 +259,7 @@ There are currently two types of licenses in place for Flipt:

### Client License

All of the code required to generate GRPC clients in other languages as well as the existing GRPC Go client are licensed under the [MIT License](https://spdx.org/licenses/MIT.html).
All of the code required to generate GRPC clients in other languages as well as the [Go SDK](/sdk/go) are licensed under the [MIT License](https://spdx.org/licenses/MIT.html).

This code exists in the [rpc/](rpc/) directory.

Expand Down
62 changes: 36 additions & 26 deletions build/generate/screenshots.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import (
)

func Screenshots(ctx context.Context, client *dagger.Client, flipt *dagger.Container) error {
if err := os.RemoveAll("./screenshots"); err != nil {
return err
}
src := client.Host().Directory("./ui/", dagger.HostDirectoryOpts{
Include: []string{
"./package.json",
Expand Down Expand Up @@ -78,28 +81,31 @@ func Screenshots(ctx context.Context, client *dagger.Client, flipt *dagger.Conta
close(containers)
}()

for _, entry := range entries {
entry := entry
g.Go(func() error {
test, err := buildUI(ctx, ui, flipt)
if err != nil {
return err
}
for _, theme := range []string{"", "dark"} {
theme := theme
for _, entry := range entries {
entry := entry
g.Go(func() error {
test, err := buildUI(ctx, ui, flipt, theme)
if err != nil {
return err
}

if ext := path.Ext(entry); ext != ".js" {
return nil
}
if ext := path.Ext(entry); ext != ".js" {
return nil
}

c, err := test.WithExec([]string{"node", path.Join("screenshot", dir, entry)}).Sync(ctx)
if err != nil {
return err
}
c, err := test.WithExec([]string{"node", path.Join("screenshot", dir, entry)}).Sync(ctx)
if err != nil {
return err
}

containers <- c
log.Printf("Generating screenshot for %s/%s\n", dir, entry)
containers <- c
log.Printf("Generating screenshot for %s %s/%s\n", theme, dir, entry)

return err
})
return err
})
}
}

for c := range containers {
Expand All @@ -113,7 +119,7 @@ func Screenshots(ctx context.Context, client *dagger.Client, flipt *dagger.Conta
return err
}

func buildUI(ctx context.Context, ui, flipt *dagger.Container) (_ *dagger.Container, err error) {
func buildUI(ctx context.Context, ui, flipt *dagger.Container, theme string) (_ *dagger.Container, err error) {
flipt, err = flipt.Sync(ctx)
if err != nil {
return nil, err
Expand All @@ -124,13 +130,17 @@ func buildUI(ctx context.Context, ui, flipt *dagger.Container) (_ *dagger.Contai
return nil, err
}

flipt = flipt.
WithEnvVariable("CI", os.Getenv("CI")).
WithEnvVariable("FLIPT_AUTHENTICATION_METHODS_TOKEN_ENABLED", "true").
WithEnvVariable("UNIQUE", time.Now().String()).
WithExposedPort(8080)

if theme != "" {
flipt = flipt.WithEnvVariable("FLIPT_UI_DEFAULT_THEME", theme)
}

return ui.
WithServiceBinding("flipt", flipt.
WithEnvVariable("CI", os.Getenv("CI")).
WithEnvVariable("FLIPT_AUTHENTICATION_METHODS_TOKEN_ENABLED", "true").
WithEnvVariable("UNIQUE", time.Now().String()).
WithExposedPort(8080).
WithExec(nil)).
WithFile("/usr/bin/flipt", flipt.File("/flipt")).
WithServiceBinding("flipt", flipt.WithExec(nil)).WithFile("/usr/bin/flipt", flipt.File("/flipt")).
WithEnvVariable("FLIPT_ADDRESS", "http://flipt:8080"), nil
}
21 changes: 21 additions & 0 deletions sdk/go/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Flipt Software Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
11 changes: 4 additions & 7 deletions ui/screenshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@ const scrollToBottom = async (page) => {
const sleep = (delay) => new Promise((resolve) => setTimeout(resolve, delay));

const capture = async function (folder, name, fn, opts = {}) {
if (!opts.namespace) {
opts.namespace = 'default';
}

try {
const path = `${__dirname}/screenshot/${folder}/fixtures/${name}.yml`;
if (fs.existsSync(path)) {
exec(
`flipt import --create-namespace --namespace=${opts.namespace} --address=${fliptAddr} ${path}`,
`flipt import --address=${fliptAddr} ${path}`,
(error, stdout, stderr) => {
if (error) {
console.error(`error: ${error.message}`);
Expand Down Expand Up @@ -56,8 +52,9 @@ const capture = async function (folder, name, fn, opts = {}) {

await page.goto(fliptAddr);
await fn(page);
await sleep(4000);
await screenshot(page, `${folder}/${name}.png`);
await sleep(5000);
let random = Math.floor(Math.random() * 100000);
await screenshot(page, `${folder}/${name}${random}.png`);

await context.close();
await browser.close();
Expand Down
2 changes: 1 addition & 1 deletion ui/screenshot/concepts/distributions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ const { capture } = require('../../screenshot.js');
(async () => {
await capture('concepts', 'distributions', async (page) => {
await page.getByRole('link', { name: 'colorscheme' }).click();
await page.getByRole('link', { name: 'Evaluation' }).click();
await page.getByRole('link', { name: 'Rules' }).click();
});
})();
13 changes: 4 additions & 9 deletions ui/screenshot/concepts/namespaces_production.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
const { capture } = require('../../screenshot.js');

(async () => {
await capture(
'concepts',
'namespaces_production',
async (page) => {
await page.getByRole('button', { name: 'Default' }).click();
await page.getByText('production').click();
},
{ namespace: 'production' }
);
await capture('concepts', 'namespaces_production', async (page) => {
await page.getByRole('button', { name: 'Default' }).click();
await page.getByText('production').click();
});
})();
2 changes: 1 addition & 1 deletion ui/screenshot/concepts/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ const { capture } = require('../../screenshot.js');
(async () => {
await capture('concepts', 'rules', async (page) => {
await page.getByRole('link', { name: 'colorscheme' }).click();
await page.getByRole('link', { name: 'Evaluation' }).click();
await page.getByRole('link', { name: 'Rules' }).click();
});
})();
12 changes: 0 additions & 12 deletions ui/screenshot/extra/darkmode.js

This file was deleted.

2 changes: 1 addition & 1 deletion ui/screenshot/getting_started/create-rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { capture } = require('../../screenshot.js');
(async () => {
await capture('getting_started', 'create_rule', async (page) => {
await page.getByRole('link', { name: 'new-login' }).click();
await page.getByRole('link', { name: 'Evaluation' }).click();
await page.getByRole('link', { name: 'Rules' }).click();
await page.getByRole('button', { name: 'New Rule' }).click();
await page.locator('#segmentKey-select-button').click();
await page.getByText('all-users').click();
Expand Down

0 comments on commit b4e6e64

Please sign in to comment.