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

Update README and INSTRUCTIONS #8

Merged
merged 8 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
192 changes: 0 additions & 192 deletions INSTRUCTIONS.md

This file was deleted.

118 changes: 80 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,99 @@
# Landscape Tools
# LFX Landscape Tools

[![License](https://img.shields.io/github/license/jmertic/landscape-tools)](LICENSE)
[![CI](https://github.com/jmertic/landscape-tools/workflows/CI/badge.svg)](https://github.com/jmertic/landscape-tools/actions?query=workflow%3ACI)
[![codecov](https://codecov.io/gh/jmertic/landscape-tools/graph/badge.svg?token=A05TDQO69V)](https://codecov.io/gh/jmertic/landscape-tools)
[![CodeQL](https://github.com/jmertic/landscape-tools/actions/workflows/codeql.yml/badge.svg)](https://github.com/jmertic/landscape-tools/actions/workflows/codeql.yml)
[![License](https://img.shields.io/github/license/jmertic/lfx-landscape-tools)](LICENSE)
[![CI](https://github.com/jmertic/lfx-landscape-tools/workflows/CI/badge.svg)](https://github.com/jmertic/lfx-landscape-tools/actions?query=workflow%3ACI)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=jmertic_lfx-landscape-tools&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=jmertic_lfx-landscape-tools)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=jmertic_lfx-landscape-tools&metric=coverage)](https://sonarcloud.io/summary/new_code?id=jmertic_lfx-landscape-tools)

This project contains some tools for making it easier to build and maintain a [landscape](https://github.com/cncf/landscapeapp).
This project contains tools that make building and maintaining a [landscape](https://github.com/cncf/landscapeapp) easier by pulling data from LFX on projects and members.

Current tools are:
It is an evolution of the former [landscape-tools](https://github.com/jmertic/landscape-tools), with a refactor to add the ability to pull projects from LFX and generate text logos when a pure SVG does not exist. Additional differences include:

- [landscapemembers.py](landscapemembers.py) - Creates a new landscape.yml or updates an existing landscape.yml file with members populated. Leverages LF SFDC as the primary data source for members include, and uses Crunchbase and [other landscapes](https://github.com/cncf/landscapeapp/blob/master/landscapes.yml) as secondary data sources for data enrichment.
- [makememberprojectlogos.sh](makememberprojectlogos.sh) - Creates uniform project/product logos for an organization where they don't have a specific logo to use.
- [downloadcrunchbasedata.sh](downloadcrunchbasedata.sh) - Fetches the latest CSV dump of organizations from crunchbase
- [buildimages.sh](buildimages.sh) - Creates images for all the projects of a given company, using the given image as base and adds the project name underneath.
- Only leverage LFX data for members and projects; no longer looks up in CrunchBase or other landscapes.
- Pull review data from a TAC repo using a specific project format, if used.
- More verbose error messages that improve debugging.

## Installation
## Setting up the GitHub Action

```bash
git clone https://github.com/jmertic/landscape-tools
cd landscape-tools
pip install -r requirements.txt
1) Add [secrets](https://docs.github.com/en/actions/reference/encrypted-secrets) for `PAT`, which is a [GitHub Personal Authorization Token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) set for the `repo` scope.
2) [Add a new label](https://docs.github.com/en/github/managing-your-work-on-github/managing-labels#creating-a-label) - `automated-build`. This is for this workflow to work and shouldn't be used for anything else.
3) Add the following code to a `build.yml` file in your landscape repo's `.github/workflows/` directory.

```yaml
name: Build Landscape from LFX

on:
workflow_dispatch:
schedule:
- cron: "0 4 * * *"

jobs:
build:
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit
- uses: jmertic/lfx-landscape-tools@main
with:
project_processing: skip # see options in action.yml
env:
token: ${{ secrets.PAT }}
repository: ${{ github.repository }}
ref: ${{ github.ref }}
```
4) Add the following code to a `validate.yml` file in your landscape repo's `.github/workflows/` directory.

If you wish to use crunchbase as a data source, add this command.
```yaml
name: Validate Landscape

```bash
./downloadcrunchbasedata.sh
on:
merge_group:
pull_request:
branches:
- main
- master

jobs:
validate-landscape:
runs-on: ubuntu-latest
name: "Validate landscape.yml file"
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: cncf/landscape2-validate-action@7f299c46e9b03b4e8bc2896882734fb0b0756b37 # v2.0.0
with:
target_kind: data
target_path: ./landscape.yml
- uses: pascalgn/automerge-action@7961b8b5eec56cc088c140b56d864285eabd3f67 # v0.16.4
if: success()
env:
GITHUB_TOKEN: "${{ secrets.PAT }}"
MERGE_LABELS: "automated-build"
MERGE_RETRY_SLEEP: 300000
MERGE_METHOD: "squash"
```

## Configuration
## Local install

All of the Python scripts depend on a `config.yaml` file being present in the same directory as the script to provide any configuration variables, or passing a `-c` option to the script with a path to the config file. Settings are below.
You can install this tool on your local computer via `pipx`

```yaml
landscapeName: # short name of your landscape - matches entry at https://github.com/cncf/landscapeapp/blob/master/landscapes.yml
landscapeMemberClasses: # classes of membership; name matches how it's listed in LF SFDC, and category how it will be listed in the landscape. Example below...
- name: Associate Membership
category: Associate
- name: Gold Membership
category: Gold
- name: Platinum Membership
category: Platinum
- name: Silver Membership
category: Silver
project: # project slug
landscapeMemberCategory: # category name of the members section in the landscape.yml file
landscapefile: # filename to use for the outputted landscape.yml file
missingcsvfile: # filename to use for the list of entries with missing parts ( such as a logo, website, or crunchbase entry )
```bash
pipx install git+https://github.com/jmertic/lfx-landscape-tools.git
```

### Environment variables
Similarly, you can use the command below to upgrade your local install.

```bash
pipx upgrade lfx-landscape-tools
```

This depends on `CRUNCHBASE_KEY` being set to a valid key if you wish to use that as a data source ( required by [downloadcrunchbasedata.sh](downloadcrunchbasedata.sh) ).
You can then use the `lfxlandscape` command to run the various commands. Use `lfxlandscape --help` for the options.

## Contributing

Expand Down