Skip to content
Romans Malinovskis edited this page Apr 9, 2020 · 5 revisions

Agile Toolkit infrastructure is awesome (I build infrastructures like that for major UK companies - for my day job at https://and.digital. More info https://nearly.guru/devops)

Just commit and the magic will happen!

Infrastructure as a code

All infrastructure for Agile Toolkit is coded. Some of it is managed by terraform, some other things are implemented through Github Actions / Workflows. It's simple enough for anyone to modify and any change can be requested through PR.

Core and Add-on repositories

ATK hosts over 20 repositories some of those are core: ("ui", "dsql", "data", "core" and "api"), and many others are Add-ons: ("login", "outbox", "report" etc). Over the time add-ons may transfer into "core" repository status. Rules around "add-on" repositories are more relaxed.

Contributors, Maintainers and Owners

Due to GitHub changes, we're now limited no number of "owners" we can have on our current data plan, but we can have unlimited number of contributors. Each contributor can have a permission (explained here: https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/repository-permission-levels-for-an-organization#permission-levels-for-repositories-owned-by-an-organization)

ATK manages owners, contributors and maintainers through terraform and grants permissions on per-repository basis individually.

Anonymous Contributors

ATK is open-source and always welcomes contributors. Anyone can create PR into any public ATK repository by forking. There are two limitations however:

  • some status checks will not run
  • limited access to ticket / PR management
  • may be difficult to collaborate on branches with others

Contributors

When someone is contributing consistently, ATK community is willing to promote them to ATK Contributor. That's done by including their name: https://github.com/atk4/infrastructure/blob/master/projects/agiletoolkit.org/github/agiletoolkit.org/github.tf#L19 (github_contributors). This gives the following extra permissions:

  • maintain permission for add-on repositories, so that they can approve PRs in repos such as "atk4/login"
  • push permissions for core repositories, so that they can use "feature/abc" in "atk4/core"

Maintainers

Contributors with good judgement and willingness to work with others as a team will be promoted to Maintainers. (https://github.com/atk4/infrastructure/pull/3). Maintainers get extra permissions for:

  • maintain core repositories, approve/reject PRs, gete branches, make releases etc.

Contributor can be anyone who has created several PRs into ATK repositories. Once they are added into Contributor group, they'll be able to review+merge other people PRs for add-ons and push new feature branches into core repositories.

Maintainers are active members of community who have permission to review+merge PR in core repositories.

Owners have admin ability in core repositories as well as access to some protected repositories (project related to agile toolkit, like Saasty).

Edit here: https://github.com/atk4/infrastructure/blob/master/root/agiletoolkit.org/github.tf#L11

Adding new ATK add-on

Simply PR into this file: https://github.com/atk4/infrastructure/blob/master/root/agiletoolkit.org/addon-repos.tf#L157.

If repository already exist, process is slightly more complex and would import setup of TF/Github tokens (script is here: https://github.com/atk4/infrastructure/blob/master/root/import-addon.sh)

ATK build image

All builds are using Docker image provisioned here: https://github.com/atk4/image. Root folder is for latest PHP version and sub-folders for legacy PHP versions. To add new PHP version support, create new sub-folder and run "make" (which will create Dockerfile inside your folder). If you are modifying Dockerfile you should also run make to update respective Dockerfile's in subfolders.

After pushing into master, builds should start here: https://hub.docker.com/repository/docker/atk4/image/builds. If new version tag should be supported for PHP, add automated build config by linking respective 7.x/Dockerfile with a tag.

Once new image tag is built, you can start using it through workflow matrix: (https://github.com/atk4/data/pull/492/files#diff-4794c8638bc5e5ec555e780ee618f61fR19)

Setting up Unit Tests

Using files here as a reference: https://github.com/atk4/data/tree/develop/.github/workflows - copy them into your repository.

unit-test.yml shows a great example how to use MySQL / PostgreSQL and multi-version build. If any extra binaries are required (e.g. lessc), they should be baked into "atk4/image" to speed up builds.

CodeCov.io must be enabled manually for each repository, if you wish to track code coverage and added as a project secret.

Release drafter

We rely on 3rd party release drafter app to convert PRs into release notes. Template for the release file is here: https://github.com/atk4/dsql/blob/develop/.github/release-drafter.yml. Huge thanks to https://github.com/release-drafter/release-drafter!

Release drafter action will execute on PR merge (into develop).

Drafting new release

To start new release create branch (from develop) called "release/1.2.3". This can be done through Github interface easily. This will trigger "Bundler" action, which will automatically updated dependencies for the project and create release PR with further instructions.

Starting from version 2.0 we're squishing all PRs, therefore "master" branch will have one commit per release, while develop branch will have one commit per PR.

Setting up new repositories

Copy .github folder form existing project (e.g. atk4/dsql) into the new project and test.

In case of problem

Create Issue for the infrastructure problem!

Happy hacking!