Skip to content

Commit

Permalink
Merge pull request #7 from SUSE/develop
Browse files Browse the repository at this point in the history
Merge from develop
  • Loading branch information
devpro authored Sep 6, 2024
2 parents e2fc39b + 817a36d commit de8bbc9
Show file tree
Hide file tree
Showing 260 changed files with 24,060 additions and 1 deletion.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# sets global approvers
* @devpro @hierynomus
115 changes: 115 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: CI

on:
push:
branches:
- main
- develop
pull_request:
branches:
- develop
schedule:
- cron: "0 2 * * 1-5"
workflow_dispatch: {}

concurrency:
group: "${{ github.ref }}-${{ github.workflow }}"
cancel-in-progress: true

permissions:
contents: read
pull-requests: write

jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
apps: ${{ steps.filter.outputs.changes }}
steps:
- name: Check-out the repository
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
base: ${{ github.ref }}
filters: |
game-2048: src/game-2048/**
cow-demo: src/cow-demo/**
rancher-helloworld: src/rancher-helloworld/**
code-check:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
# gets all history for all branches and tags (mandatory for chart-testing to work, see https://github.com/helm/chart-testing/issues/186)
fetch-depth: 0
- name: Lint Markdown files
uses: DavidAnson/markdownlint-cli2-action@v16
with:
globs: '**/*.md'
# uses https://github.com/koalaman/shellcheck
- name: Install Shellcheck
run: sudo apt install shellcheck
- name: Check shell file code
run:
shellcheck -e SC2086 -e SC2034 -e SC2126 scripts/**/*.sh
- name: Install Helm
uses: azure/[email protected]
with:
version: v3.14.0
- name: Add dependency Helm chart repositories
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
check-latest: true
- name: Install Helm chart-testing
uses: helm/[email protected]
- name: List changed Helm charts
id: list-changed
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --target-branch ${{ github.event.repository.default_branch }}
image-scan:
needs: changes
if: needs.changes.outputs.apps != '[]'
strategy:
matrix:
app: ${{ fromJSON(needs.changes.outputs.apps) }}
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build container image from source
run: |
cd src/${{ matrix.app }}
docker build . --tag $CONTAINER_REGITRY_DOMAIN/$IMAGE_FOLDER/${{ matrix.app }}:${{ env.IMAGE_TAG }}
- name: Scan container image with NeuVector
if: ${{ vars.USE_NEUVECTOR == 'true' }}
uses: neuvector/scan-action@main
with:
image-repository: ${{ env.CONTAINER_REGITRY_DOMAIN }}/${{ env.IMAGE_FOLDER }}/${{ matrix.app }}
image-tag: ${{ env.IMAGE_TAG }}
min-high-cves-to-fail: "1"
min-medium-cves-to-fail: "1"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CONTAINER_REGITRY_DOMAIN: docker.io
IMAGE_FOLDER: ${{ vars.DOCKERHUB_NAMESPACE }}
IMAGE_TAG: 1.0.${{ github.run_id }}
115 changes: 115 additions & 0 deletions .github/workflows/pkg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: PKG

on:
push:
branches: [ "main" ]
workflow_dispatch:

permissions:
contents: write
pages: write
id-token: write

jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
apps: ${{ steps.filter.outputs.changes }}
steps:
- name: Check-out the repository
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
base: ${{ github.ref }}
filters: |
game-2048: src/game-2048/**
cow-demo: src/cow-demo/**
rancher-helloworld: src/rancher-helloworld/**
build:
runs-on: ubuntu-latest
steps:
- name: Check-out the repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/[email protected]
with:
version: v3.14.0
- name: Add dependency Helm chart repositories
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
- name: Host charts repository on GitHub Pages
uses: helm/[email protected]
with:
skip_existing: true
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Checkout gh-pages branch
uses: actions/checkout@v4
with:
ref: gh-pages
- name: Setup Go environment
uses: actions/setup-go@v5
- name: Generate index.html
run: |
go install github.com/halkeye/[email protected]
/home/runner/go/bin/helm-repo-html
- name: Setup Pages
uses: actions/configure-pages@v1
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
create-image:
needs: changes
if: needs.changes.outputs.apps != '[]'
strategy:
matrix:
app: ${{ fromJSON(needs.changes.outputs.apps) }}
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Login to container registry
uses: docker/login-action@v3
with:
registry: ${{ env.CONTAINER_REGITRY_DOMAIN }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build container image
run: |
cd src/${{ matrix.app }}
docker build . --tag $IMAGE_FOLDER/${{ matrix.app }}:${{ env.IMAGE_TAG }}
- name: Push image to container registry
run: docker push $IMAGE_FOLDER/${{ matrix.app }}:${{ env.IMAGE_TAG }}
- name: Push latest tag to container registry
if: ${{ github.ref_name == 'main' }}
run: |
docker tag $IMAGE_FOLDER/${{ matrix.app }}:${{ env.IMAGE_TAG }} $IMAGE_FOLDER/${{ matrix.app }}:latest
docker push $IMAGE_FOLDER/${{ matrix.app }}:latest
env:
CONTAINER_REGITRY_DOMAIN: docker.io
IMAGE_FOLDER: ${{ vars.DOCKERHUB_NAMESPACE }}
IMAGE_TAG: 1.0.${GITHUB_RUN_ID}
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# local downloaded chart compressed files
/**/charts/*.tgz

# local temporary files
temp*.yaml
temp.sh
/charts/temp/
values_mine.y*ml
.sass-cache/
7 changes: 7 additions & 0 deletions .kube-linter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
checks:
addAllBuiltIn: true
exclude:
- "no-read-only-root-fs"
- "unset-cpu-requirements"
- "unset-memory-requirements"
ignorePaths: []
4 changes: 4 additions & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ref. https://github.com/DavidAnson/markdownlint
default: true
MD013: # Line length
line_length: 240
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Contribution guide

## Code lifecycle

This git repository follows the Gitflow pattern, so make sure to follow the convention.

For instance, create a branch `feature/my-change-title` from `develop`, once good enough to be shared and reviewed create a Pull Request targetting `develop`.

## Code convention

For bash/shell script files, follow the conventions from [Google Style Guide](https://google.github.io/styleguide/shellguide.html).
Loading

0 comments on commit de8bbc9

Please sign in to comment.