Skip to content

Commit

Permalink
Merge branch 'main' into landscape2-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jmertic authored Nov 11, 2024
2 parents e26e96f + e543b9b commit 1152b24
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 238 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0
uses: github/codeql-action/init@4f3212b61783c3c68e8309a0f18a699764811cda # v3.27.1
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
Expand All @@ -95,6 +95,6 @@ jobs:
exit 1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0
uses: github/codeql-action/analyze@4f3212b61783c3c68e8309a0f18a699764811cda # v3.27.1
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard (optional).
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0
uses: github/codeql-action/upload-sarif@4f3212b61783c3c68e8309a0f18a699764811cda # v3.27.1
with:
sarif_file: results.sarif
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
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license = "Apache-2.0"
python = ">= 3.12"
requests = "^2.32.3"
pycairo = "^1.27.0"
pygithub = "^2.4.0"
pygithub = "^2.5.0"
python-slugify = "^8.0.4"
requests-cache = "^1.2.1"
ruamel-yaml = "^0.18.6"
Expand Down

0 comments on commit 1152b24

Please sign in to comment.