|
| 1 | +# fatt/installer-action |
| 2 | + |
| 3 | +This action enables you to install `fatt` on your runner. During installation the integrity of `fatt` is verified based on it's cosign signature. |
| 4 | + |
| 5 | +For a quick start guide on the usage of `fatt`, please refer to https://github.com/philips-labs/fatt#quick-start. |
| 6 | +For available `cosign` releases, see https://github.com/sigstore/cosign/releases. |
| 7 | + |
| 8 | +## Usage |
| 9 | + |
| 10 | +This action currently supports GitHub-provided Linux, macOS and Windows runners. |
| 11 | + |
| 12 | +Add the following entry to your Github workflow YAML file: |
| 13 | + |
| 14 | +```yaml |
| 15 | +uses: philips-labs/fatt/installer-action@main |
| 16 | +with: |
| 17 | + fatt-release: 'v0.2.0' # optional |
| 18 | + install-path: '.fatt/bin' #optional |
| 19 | +``` |
| 20 | +
|
| 21 | +Now you can use fatt to `list` and `publish` attestations. Keep in mind to add `packages: write` permission if you want to publish the attestations to oci. |
| 22 | + |
| 23 | +## Example |
| 24 | + |
| 25 | +```yaml |
| 26 | +jobs: |
| 27 | + publish-attestations: |
| 28 | + runs-on: ubuntu-20.04 |
| 29 | +
|
| 30 | + permissions: |
| 31 | + packages: write |
| 32 | +
|
| 33 | + env: |
| 34 | + PACKAGE: ghcr.io/philips-labs/fatt/attestations-example |
| 35 | + PACKAGE_VERSION: v0.2.0 |
| 36 | +
|
| 37 | + steps: |
| 38 | + - name: Install cosign |
| 39 | + |
| 40 | + with: |
| 41 | + cosign-release: v1.6.0 |
| 42 | +
|
| 43 | + - name: Install fatt |
| 44 | + uses: philips-labs/fatt/installer-action@main |
| 45 | + with: |
| 46 | + fatt-release: v0.2.0 |
| 47 | + install-dir: .fatt/bin |
| 48 | +
|
| 49 | + - name: Generate SBOM |
| 50 | + run: echo 'We could have generated a real sbom using syft here…' > sbom-spdx.json |
| 51 | +
|
| 52 | + - name: Generate provenance |
| 53 | + run: echo 'We can use philips-labs/slsa-provenance-action to generate provenance…' > provenance.att |
| 54 | +
|
| 55 | + - name: Login to ghcr.io |
| 56 | + uses: docker/login-action@dd4fa0671be5250ee6f50aedf4cb05514abda2c7 #v1.14.1 |
| 57 | + with: |
| 58 | + registry: ghcr.io |
| 59 | + username: ${{ github.actor }} |
| 60 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 61 | +
|
| 62 | + - name: Install signing key |
| 63 | + run: echo "${{ secrets.COSIGN_PRIVATE_KEY }}" > cosign.key |
| 64 | +
|
| 65 | + - name: Publish attestations |
| 66 | + run: | |
| 67 | + fatt publish \ |
| 68 | + --repository "${PACKAGE}" \ |
| 69 | + --version "${PACKAGE_VERSION}" \ |
| 70 | + "sbom://sbom-spdx.json" "provenance://provenance.att" |
| 71 | +
|
| 72 | + - name: Sign attestations and discovery |
| 73 | + run: | |
| 74 | + cosign sign --key cosign.key "${PACKAGE}:${PACKAGE_VERSION}.provenance" |
| 75 | + cosign sign --key cosign.key "${PACKAGE}:${PACKAGE_VERSION}.sbom" |
| 76 | + cosign sign --key cosign.key "${PACKAGE}:${PACKAGE_VERSION}.discovery" |
| 77 | + env: |
| 78 | + COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }} |
| 79 | +
|
| 80 | + - name: Discover attestations |
| 81 | + run: | |
| 82 | + echo "${{ secrets.COSIGN_PUBLIC_KEY }}" > cosign.pub |
| 83 | + fatt list --key cosign.pub "${PACKAGE}:${PACKAGE_VERSION}.discovery" |
| 84 | +
|
| 85 | + - name: Cleanup signing key |
| 86 | + if: ${{ always() }} |
| 87 | + run: rm cosign.key |
| 88 | +``` |
0 commit comments