Giter Club home page Giter Club logo

teams-action's Introduction

GitHub Action used for teams management

Actions Status

This action can be used to create Azure AD groups and GitHub teams for all teams at NAV. The action is used by navikt/teams.

When the action is triggered it will open the teams YAML file pointed to by the TEAMS_YAML_PATH environment variable, loop over all teams, and for each team it will do the following:

  • If the team already exists as a group in Azure AD, skip to the next team
  • If the team already exists as a team on GitHub, skip to the next one
  • Create a mail and security enabled group in Azure AD for the team
  • Create a GitHub team for the team

Required environment variables

The action requires the following environment variables to be set (using for instance env in a GitHub workflow):

AZURE_AD_APP_ID

The Azure AD application ID (client ID) of the application used to access the Microsoft Graph API. The application must have the following API permissions:

  • Application.ReadWrite.All
  • Group.ReadWrite.All

AZURE_AD_APP_SECRET

The Azure AD application secret of the application used to access the Microsoft Graph API.

AZURE_AD_CONTAINER_APP_ID

Each group that is created by this action will be added to this enterprise application. This is the object ID of the application. This application is used to easily identify teams managed by this solution.

AZURE_AD_CONTAINER_APP_ROLE_ID

When adding groups to the enterprise application they will receive this role.

GITHUB_PAT

The personal access token used to access the GitHub API. The token must have the following scopes:

  • admin:org

The token must also be enabled for SSO.

The reason for using a personal access token instead of the auto-generated GITHUB_TOKEN is because the Team synchronization API does not support GitHub App authentication yet. Once this is supported the GITHUB_PAT secret can be superseded by the auto generated GITHUB_TOKEN.

TEAMS_YAML_PATH

Path to where the teams YAML file is located. Documentation regarding this file is available in the navikt/teams repository.

NAIS_DEPLOYMENT_API_SECRET

Hex-encoded secret used to create Nais deployment key for the teams.

COMMITTER

GitHub username of the user who committed the change. This user will be added as an owner to the created Azure AD group.

Optional environment variables

AAD_OWNER_GROUPS

Comma separated list of Azure AD group object IDs to add the user object that is connected to COMMITTER to.

Release a new version

There is a workflow that runs when a tag starting with v is pushed, which publishes a docker image to dockerhub.

teams-action's People

Contributors

christeredvartsen avatar dependabot[bot] avatar kimtore avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

teams-action's Issues

Make the workflow easier to expand

Currently the workflow exits if the group already exists in Azure AD, or as a GitHub team. This needs to be changed so that it's easier to add functionality later on and simply re-run the entire workflow to add / remove properties to the teams.

Change lower length limit to 3

Currently the regular expression requires team names to be more than 3 in length. This should be lowered to accept 3.

Use tags to release versions

Currently the docker image published the image for all branches, and has a master release at the latest version. We should start to release based on tags instead, so workflows can target the version of the action instead of the branch name.

Retry creation of Nais deployment key

From time to time the Nais Deployment provisioning API fails with a message saying that the team does not exist, even though it actually does exist. This is because of Microsofts API sometimes takes too long to provide the correct data.

Generate NAIS deploy key when creating teams

When creating teams the action should also generate a NAIS deploy key for the team using the hookd-API on https://deployment.prod-sbs.nais.io/api/v1/provision.

The payload to be sent using HTTP POST will include the name of the team a boolean informing hookd as to whether or not the key should be rotated, and a timestamp:

{
  "team": "<team name>",
  "rotate": <bool>,
  "timestamp": <unix timestamp>
}

The request must include a signature, which is is keyed hash of the payload, using sha256 and a pre-shared key. The signature is attached to the request in the x-nais-signature header.

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.