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

Add initial version #1

Merged
merged 1 commit into from
Oct 31, 2022
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
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Ignore everything
*

# Allow files and directories
!Gemfile
!Gemfile.lock
!fluent.conf
!fluent.yaml
!entrypoint.sh
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# All
[*]
charset = utf-8
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
max_line_length = off

# Markdown uses whitespace for formatting
[*.md]
trim_trailing_whitespace = false
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto eol=lf
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably want to add Linux shell scripts as well as they don't like the wrong line ending either

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 1 says everything will use lf unless explicitly overridden, so only file types needing crlf need specifying.

Empty file added .github/CODEOWNERS
Empty file.
17 changes: 17 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
- package-ecosystem: docker
directory: /
schedule:
interval: daily
- package-ecosystem: bundler
directory: /
ignore:
- dependency-name: async
versions: [">=2"]
schedule:
interval: daily
144 changes: 144 additions & 0 deletions .github/workflows/commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: Commit

on:
push:
branches:
- main

jobs:
build:
name: Build OCI Image
permissions: write-all
strategy:
fail-fast: false
matrix:
os: [alpine, debian]
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8

- name: Install Cosign
uses: sigstore/cosign-installer@9becc617647dfa20ae7b1151972e9b3a2c338a2b

- name: Run Hadolint
id: hadolint
uses: hadolint/hadolint-action@f988afea3da57ee48710a9795b6bb677cc901183
continue-on-error: true
with:
dockerfile: ./${{ matrix.os }}.dockerfile
format: sarif
output-file: hadolint.sarif
no-fail: false

- name: Upload Hadolint SARIF report
uses: github/codeql-action/upload-sarif@ec3cf9c605b848da5f1e41e8452719eb1ccfb9a6
with:
category: hadolint
sarif_file: hadolint.sarif

- name: Generate OCI image metadata
id: metadata
uses: docker/metadata-action@57396166ad8aefe6098280995947635806a0e6ea
with:
flavor: |
latest=false
images: |
ghcr.io/${{ github.repository }}
docker.io/${{ github.repository }}
tags: |
type=raw,value=${{ matrix.os }}-main
type=raw,value=main,enable=${{ matrix.os == 'alpine' }}
labels: |
org.opencontainers.image.description=Fluentd aggregator OCI image based on the default Fluentd OCI image.
org.opencontainers.image.authors=Fluentd developers <fluentd@googlegroups.com>

- name: Set up QEMU
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8c0edbc76e98fa90f69d9a2c020dcb50019dc325

- name: Build OCI image
id: build
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5
with:
file: ./${{ matrix.os }}.dockerfile
context: .
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
load: true
stevehipwell marked this conversation as resolved.
Show resolved Hide resolved
push: false

- name: Generate OCI image SBOM
uses: anchore/sbom-action@b7e8507c6a3c89b7099a0198366d862c8f3ad8f1
with:
image: "ghcr.io/${{ github.repository }}:${{ matrix.os }}-main"
dependency-snapshot: true
format: spdx-json
artifact-name: ${{ github.event.repository.name }}-sbom.spdx.json
output-file: ${{ github.event.repository.name }}-sbom.spdx.json

- name: Scan OCI image SBOM with Grype
id: scan
uses: anchore/scan-action@d5aa5b6cb9414b0c7771438046ff5bcfa2854ed7
continue-on-error: true
with:
sbom: ${{ github.event.repository.name }}-sbom.spdx.json
severity-cutoff: medium
output-format: sarif
fail-build: true

- name: Upload Grype SARIF report
uses: github/codeql-action/upload-sarif@ec3cf9c605b848da5f1e41e8452719eb1ccfb9a6
with:
category: grype
sarif_file: ${{ steps.scan.outputs.sarif }}

- name: Fail workflow
if: ${{ steps.hadolint.outcome == 'failure' && steps.scan.outcome == 'failure' }}
run: |
set -euo pipefail
echo "::error::Code scanning failed."
exit 1

- name: Login to GitHub Container Registry
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to DockerHub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build & push OCI image
id: build_push
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5
with:
file: ./${{ matrix.os }}.dockerfile
context: .
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
load: false
push: true

- name: Sign OCI image
env:
COSIGN_EXPERIMENTAL: true
run: |
set -euo pipefail
cosign sign --yes --recursive ghcr.io/${{ github.repository }}:main@${{ steps.build_push.outputs.digest }}
cosign sign --yes --recursive docker.io/${{ github.repository }}:main@${{ steps.build_push.outputs.digest }}
91 changes: 91 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Pull Request

on:
pull_request:
branches:
- main

jobs:
build:
name: Build OCI Image
permissions: write-all
strategy:
fail-fast: false
matrix:
os: [alpine, debian]
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8

- name: Run Hadolint
uses: hadolint/hadolint-action@f988afea3da57ee48710a9795b6bb677cc901183
with:
dockerfile: ./${{ matrix.os }}.dockerfile
format: sarif
output-file: hadolint.sarif
no-fail: true

- name: Upload Hadolint SARIF report
uses: github/codeql-action/upload-sarif@ec3cf9c605b848da5f1e41e8452719eb1ccfb9a6
with:
category: hadolint
sarif_file: hadolint.sarif

- name: Generate OCI image metadata
id: metadata
uses: docker/metadata-action@57396166ad8aefe6098280995947635806a0e6ea
with:
flavor: |
latest=false
images: |
${{ github.repository }}
tags: |
type=raw,value=${{ matrix.os }}-local
labels: |
org.opencontainers.image.description=Fluentd aggregator OCI image based on the default Fluentd OCI image.
org.opencontainers.image.authors=Fluentd developers <fluentd@googlegroups.com>
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8c0edbc76e98fa90f69d9a2c020dcb50019dc325

- name: Build OCI image
id: build
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5
with:
file: ./${{ matrix.os }}.dockerfile
context: .
platforms: linux/amd64
stevehipwell marked this conversation as resolved.
Show resolved Hide resolved
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
load: true
push: false

- name: Generate OCI image SBOM
uses: anchore/sbom-action@b7e8507c6a3c89b7099a0198366d862c8f3ad8f1
with:
image: "${{ github.repository }}:${{ matrix.os }}-local"
dependency-snapshot: true
format: spdx-json
artifact-name: ${{ github.event.repository.name }}-sbom.spdx.json
output-file: ${{ github.event.repository.name }}-sbom.spdx.json

- name: Scan OCI image SBOM with Grype
id: scan
uses: anchore/scan-action@d5aa5b6cb9414b0c7771438046ff5bcfa2854ed7
with:
sbom: ${{ github.event.repository.name }}-sbom.spdx.json
severity-cutoff: medium
output-format: sarif
fail-build: false

- name: Upload Grype SARIF report
uses: github/codeql-action/upload-sarif@ec3cf9c605b848da5f1e41e8452719eb1ccfb9a6
with:
category: grype
sarif_file: ${{ steps.scan.outputs.sarif }}
Loading