GithubHelp home page GithubHelp logo

aguanslamet / cocoon Goto Github PK

View Code? Open in Web Editor NEW

This project forked from flutter/cocoon

0.0 1.0 0.0 1.71 MB

Flutter's build coordinator and aggregator

License: BSD 3-Clause "New" or "Revised" License

Shell 0.30% Dart 84.57% Go 10.97% HTML 1.46% CSS 0.96% Python 1.02% Java 0.04% Ruby 0.21% Objective-C 0.08% PowerShell 0.15% Dockerfile 0.13% JavaScript 0.04% Kotlin 0.03% Swift 0.04%

cocoon's Introduction

Cocoon is a hybrid Go App Engine (backend) and an Angular 2 Dart (client) app used to coordinate and aggregate the results of Flutter's builds. It is not designed to help developers build Flutter apps. More importantly, Cocoon is not a Google product.

Developing cocoon

  • Learn App Engine for Go
  • Learn Angular 2 for Dart
  • Create $GOPATH/src where $GOPATH can be anywhere
  • git clone this repository into $GOPATH/src so that you have $GOPATH/src/cocoon
  • Install Google App Engine for Go
  • Install Go SDK
  • Install Dart SDK

Running local dev server

The following command will start a local Go App Engine server and a Dart pub server.

cd app
pub get
go get
dart bin/dev_server.dart

Once the log messages quiet down you should be able to open http://localhost:8080 and see the status dashboard backed by a fake local datastore.

Testing Angular changes with production data

Run dart bin/dev_server.dart with the option go/flutter-dev-server-auth. This will cause the dev server to call the production servers for all API calls. This only works for testing Angular changes. Changes in Go code require building and deploying the whole thing (see next section).

Building Cocoon for deployment

The following command will run tests and build the app, and provide instructions for deploying to Google App Engine.

cd app
bin/build_and_test.sh

You can test the new version by accessing {VERSION}-dot-flutter-dashboard.appspot.com in your browser. If the result is satisfactory, the new version can be activated by using the Cloud Console UI: https://pantheon.corp.google.com/appengine/versions?project=flutter-dashboard&serviceId=default

Design

Cocoon creates a checklist for each Flutter commit. A checklist is made of multiple tasks. Tasks are performed by agents. An agent is a computer capable of running a subset of tasks in the checklist. To perform a task an agent reserves it in Cocoon. Cocoon issues tasks according to agents' capabilities. Each task has a list of required capabilities. For example, a task might require that a physical Android device is attached to an agent. It then lists "has-physical-android-phone" capability as required. Multiple agents may share the same capability. Cocoon will distribute tasks amongst agents. That's how Cocoon scales.

In-browser CLI

Cocoon browser interface includes a small CLI. To access it open Chrome Dev Tools > Console. Commands are entered directly into the console like this:

cocoon.COMMAND([COMMAND_ARGS...])

The list of available commands is printed to the console when the page is loaded.

Creating an agent

The following command creates an agent with ID "bot-with-devices", and which has two capabilities: "has-android-phone" and "has-iphone".

cocoon.createAgent(['-a', 'bot-with-devices', '-c', 'has-android-phone', '-c', 'has-iphone'])

Agent ID is passed as option -a, and agent's capabilities are passed as one or more -c.

IMPORTANT: This command returns an authentication token. Cocoon does not store the token, so copy it immediately and add it to the agent's configuration file. If the token is lost or compromised, use the "auth-agent" command below to generate a new token.

Authorizing an agent

The following commands generates an authentication token for an agent.

cocoon.authAgent(['-a', 'bot-with-devices'])

IMPORTANT: See the IMPORTANT note in "Creating an agent". Also note that this command invalidates any previously issued authentication tokens for the given agent. Only one authentication token is valid at any given moment in time. Therefore, if the agent is currently using a previously issued token its API requests will be rejected until it switches to using the newly created token.

Forcing a refresh from GitHub

Cocoon is driven by commits made to https://github.com/flutter/flutter repo. It periodically syncs new commits. If you need to manually force a refresh, issue the following CLI command:

cocoon.refreshGithubCommits([])

cocoon's People

Contributors

yjbanov avatar tvolkert avatar jmagman avatar dnfield avatar caseyhillers avatar cbracken avatar hixie avatar jonahwilliams avatar goderbauer avatar aam avatar devoncarew avatar piinks avatar digiter avatar keyonghan avatar abarth avatar bkonyi avatar collinjackson avatar johnmccutchan avatar mravn-google avatar sbaranov avatar liyuqian avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.