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

🌱 preparing tech-preview release #3

Merged
merged 1 commit into from
Sep 17, 2023
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .builder-image-version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.0
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: 'Bug report'
about: Tell us about a problem you are experiencing.

---

/kind bug

**What steps did you take and what happened:**
[A clear and concise description of what the bug is.]


**What did you expect to happen:**


**Anything else you would like to add:**
[Miscellaneous information that will assist in solving the issue.]


**Environment:**

- cluster-stack-operator version:
- Kubernetes version: (use `kubectl version`)
- OS (e.g. from `/etc/os-release`):
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: 'Feature request'
about: Suggest an idea for this project.

---

/kind feature

**Describe the solution you'd like**
[A clear and concise description of what you want to happen.]


**Anything else you would like to add:**
[Miscellaneous information that will assist in solving the issue.]


**Environment:**

- cluster-stack-operator version:
- Kubernetes version: (use `kubectl version`)
- OS (e.g. from `/etc/os-release`):
29 changes: 29 additions & 0 deletions .github/actions/metadata/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "Metadata"
description: "Generate Image Metadata"
inputs:
metadata_flavor:
description: "metadata_flavor"
required: true
metadata_tags:
description: "metadata_tags"
required: true
outputs:
tags:
description: "generated image tags"
value: ${{ steps.meta.outputs.tags }}
labels:
description: "generated image labels"
value: ${{ steps.meta.outputs.labels }}
version:
description: "generated image version"
value: ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
runs:
using: "composite"
steps:
- name: Docker manager metadata
id: meta
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 # v4.6.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: ${{ inputs.metadata_flavor }}
tags: ${{ inputs.metadata_tags }}
30 changes: 30 additions & 0 deletions .github/actions/setup-go/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "Setup Go"
description: "Setup Go"
runs:
using: "composite"
steps:
- name: Install go
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version-file: "go.mod"
cache: true
cache-dependency-path: go.sum
- id: go-cache-paths
shell: bash
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
- name: Go Mod Cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-mod-
- name: Go Build Cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-build-
16 changes: 16 additions & 0 deletions .github/labeler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
area/code:
- "controllers/**/*"
- "pkg/**/*"
area/api:
- "api/**/*"
- "config/crd/**/*"
area/github:
- ".github/**/*"
area/hack:
- "hack/**/*"
- "Makefile"
area/test:
- "test/**/*"
area/templates:
- "templates/**/*"
80 changes: 80 additions & 0 deletions .github/labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
# Area
- name: area/code
color: "72ccf3"
description: >-
Changes made in the code directory
- name: area/api
color: "72ccf3"
description: >-
Changes made in the api directory
- name: area/github
color: "72ccf3"
description: >-
Changes made in the github directory
- name: area/hack
color: "72ccf3"
description: >-
Changes made in the hack directory
- name: area/test
color: "72ccf3"
description: >-
Changes made in the test directory
- name: area/templates
color: "72ccf3"
description: >-
Changes made in the templates directory
# Update
- name: update/container
color: "ffc300"
- name: update/github-action
color: "ffc300"
- name: update/helm
color: "ffc300"
- name: update/go
color: "ffc300"
# Semantic Type
- name: type/patch
color: "FFEC19"
- name: type/minor
color: "FF9800"
- name: type/major
color: "F6412D"
# Size
- name: size/XS
color: "009900"
description: >-
Denotes a PR that changes 0-20 lines, ignoring generated files.
- name: size/S
color: "77bb00"
description: >-
Denotes a PR that changes 20-50 lines, ignoring generated files.
- name: size/M
color: "eebb00"
description: >-
Denotes a PR that changes 50-200 lines, ignoring generated files.
- name: size/L
color: "ee9900"
description: >-
Denotes a PR that changes 200-800 lines, ignoring generated files.
- name: size/XL
color: "ee5500"
description: >-
Denotes a PR that changes 800-2000 lines, ignoring generated files.
- name: size/XXL
color: "ee0000"
description: >-
Denotes a PR that changes 2000+ lines, ignoring generated files.
# Uncategorized
- name: bug
color: "ee0701"
- name: do-not-merge
color: "ee0701"
- name: docs
color: "F4D1B7"
- name: enhancement
color: "84b6eb"
- name: link-checker
color: "7B55D7"
- name: question
color: "cc317c"
19 changes: 19 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- If this is your first PR, welcome! Please make sure you read the [contributing guidelines](../CONTRIBUTING.md#contributing-a-patch). -->
<!-- please add an icon to the title of this PR and delete this line and similar ones -->
<!-- the icon will be either ⚠️ (:warning:, major or breaking changes), ✨ (:sparkles:, feature additions), 🐛 (:bug:, patches and bugfixes), 📖 (:book:, documentation or proposals), or 🌱 (:seedling:, minor or other) -->

**What this PR does / why we need it**:

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

_Please confirm that if this PR changes any image versions, then that's the sole change this PR makes._

**TODOs**:

- [ ] squash commits
- [ ] include documentation
- [ ] add unit tests

159 changes: 159 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
name: Build cso Image
# yamllint disable rule:line-length
on: # yamllint disable-line rule:truthy
push:
branches:
- main
# If the cache was cleaned we should re-build the cache with the latest commit
workflow_run:
workflows:
- "CSO Image Cache Cleaner"
branches:
- main
types:
- completed
workflow_dispatch:
env:
REGISTRY: ghcr.io/sovereigncloudstack
metadata_flavor: latest=true
metadata_tags: type=sha,prefix=sha-,format=short
permissions:
contents: read
packages: write
# Required to generate OIDC tokens for `sigstore/cosign-installer` authentication
id-token: write
jobs:
manager-image:
name: Build and push manager image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
with:
fetch-depth: 0
- uses: ./.github/actions/setup-go
- name: Set up QEMU
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@ecf95283f03858871ff00b787d79c419715afc34 # v2

- name: Generate metadata cso
id: metacso
uses: ./.github/actions/metadata
env:
IMAGE_NAME: cso-staging
with:
metadata_flavor: ${{ env.metadata_flavor }}
metadata_tags: ${{ env.metadata_tags }}

- name: Login to ghcr.io for CI
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Install Cosign
uses: sigstore/cosign-installer@dd6b2e2b610a11fd73dd187a43d57cc1394e35f9 # v3.0.5

- name: Setup Env
run: |
DOCKER_BUILD_LDFLAGS="$(hack/version.sh)"
echo 'DOCKER_BUILD_LDFLAGS<<EOF' >> $GITHUB_ENV
echo $DOCKER_BUILD_LDFLAGS >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV

# Load Golang cache build from GitHub
- name: Load cso Golang cache build from GitHub
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
id: cache
with:
path: /tmp/.cache/cso
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-cso-${{ github.sha }}
restore-keys: |
${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-cso-
${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-
${{ runner.os }}-go-

- name: Create cso cache directory
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
shell: bash
run: |
mkdir -p /tmp/.cache/cso

# Import GitHub's cache build to docker cache
- name: Copy cso Golang cache to docker cache
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1
with:
provenance: false
context: /tmp/.cache/cso
file: ./images/cache/Dockerfile
push: false
platforms: linux/amd64
target: import-cache

- name: Build and push cso image
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4
id: docker_build_release_cso
with:
provenance: false
context: .
file: ./images/cso/Dockerfile
push: true
build-args: |
LDFLAGS=${{ env.DOCKER_BUILD_LDFLAGS }}
tags: ${{ steps.metacso.outputs.tags }}
labels: ${{ steps.metacso.outputs.labels }}
platforms: linux/amd64

- name: Sign Container Images
env:
COSIGN_EXPERIMENTAL: "true"
run: |
cosign sign --yes ghcr.io/sovereigncloudstack/cso-staging@${{ steps.docker_build_release_cso.outputs.digest }}

- name: Image Releases digests cso
shell: bash
run: |
mkdir -p image-digest/
echo "ghcr.io/sovereigncloudstack/cso-staging:{{ steps.metacso.outputs.tags }}@${{ steps.docker_build_release_cso.outputs.digest }}" >> image-digest/cso.txt

# Upload artifact digests
- name: Upload artifact digests
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: image-digest
path: image-digest
retention-days: 90

# Store docker's golang's cache build locally only on the main branch
- name: Store cso Golang cache build locally
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1
with:
provenance: false
context: .
file: ./images/cache/Dockerfile
push: false
outputs: type=local,dest=/tmp/docker-cache-cso
platforms: linux/amd64
target: export-cache

# Store docker's golang's cache build locally only on the main branch
- name: Store cso Golang cache in GitHub cache path
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
shell: bash
run: |
mkdir -p /tmp/.cache/cso/
if [ -f /tmp/docker-cache-cso/tmp/go-build-cache.tar.gz ]; then
cp /tmp/docker-cache-cso/tmp/go-build-cache.tar.gz /tmp/.cache/cso/
fi
if [ -f /tmp/docker-cache-cso/tmp/go-pkg-cache.tar.gz ]; then
cp /tmp/docker-cache-cso/tmp/go-pkg-cache.tar.gz /tmp/.cache/cso/
fi

- name: Image Digests Output
shell: bash
run: |
cd image-digest/
find -type f | sort | xargs -d '\n' cat
Loading
Loading