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

Repo restructure project - Merge helm-locker into local #74

Merged
merged 48 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
e31a535
rename example chart to be more specific
mallardduck Sep 9, 2024
8b98ad9
Add helm-locker docs
mallardduck Sep 9, 2024
b9a50bf
Reorg more files for project merge
mallardduck Sep 9, 2024
bc925c2
Add helm-locker charts
mallardduck Sep 9, 2024
9be3772
Adjust CRD reference yaml generation
mallardduck Sep 9, 2024
10028d7
Adjust default entry point to use explicit name
mallardduck Sep 9, 2024
42eff8b
Rename docker file to be specific
mallardduck Sep 9, 2024
78cec10
Rename docker file to better name
mallardduck Sep 9, 2024
4403c88
Adjust scripts to allow targeting other entrypoints
mallardduck Sep 9, 2024
7b9cc34
simplify docker bin target
mallardduck Sep 9, 2024
6b4cdc3
move CRDs for repo merge
mallardduck Sep 9, 2024
bd7c5b9
bring helm-locker code into local repo
mallardduck Sep 9, 2024
5396999
Adjust build target logic on build scripts
mallardduck Sep 10, 2024
d11e570
Move helm-project-operator to new cmd
mallardduck Sep 10, 2024
03f32b4
Add helm-locker local CLI
mallardduck Sep 10, 2024
43bad66
Reorg GHA ci files
mallardduck Sep 10, 2024
e8e9f46
Add helm-locker GHA into local repo
mallardduck Sep 10, 2024
f310e1c
Add go generate step to linter
mallardduck Sep 10, 2024
e89bd93
Add make build chart to lint job
mallardduck Sep 10, 2024
a8cc125
switch from ioutil to io
mallardduck Sep 10, 2024
b99ed1f
Fix linting issues
mallardduck Sep 10, 2024
f660e6d
Adjust ignore/keep for git
mallardduck Sep 10, 2024
dace9d8
Adjust GHA job names for package delineation
mallardduck Sep 10, 2024
5b7dcf0
update go deps files
mallardduck Sep 10, 2024
0c929cc
correct helm-ci target
mallardduck Sep 10, 2024
9086dbd
correct build scripts
mallardduck Sep 10, 2024
e56e833
correct syntax error in GHA workflow
mallardduck Sep 10, 2024
b4531f0
rename step name to be more accurate
mallardduck Sep 10, 2024
39dfd50
Adjust how tests are done to only test target command
mallardduck Sep 10, 2024
3a885f3
update target and script path
mallardduck Sep 10, 2024
b9b2527
Add missing cluster script
mallardduck Sep 10, 2024
a03241f
Bring over tests folder from helm-locker
mallardduck Sep 10, 2024
d7a4d99
Adjust more paths for repo re-org
mallardduck Sep 10, 2024
ad90f02
tweak publish workflows to work on specific tags for now...
mallardduck Sep 11, 2024
582ff22
Adjust style for easier workflow reading
mallardduck Sep 11, 2024
d0616ac
Correct e2e job name
mallardduck Sep 11, 2024
56cf70d
correct last reference to old name
mallardduck Sep 11, 2024
92721ba
fix scirpt job name
mallardduck Sep 11, 2024
3abe679
correct path for delete script
mallardduck Sep 11, 2024
1140ae4
remove duplicate crds file
mallardduck Sep 11, 2024
464f1fd
Merge 2 publish workflows into 1
mallardduck Sep 23, 2024
6d3ae41
Correct job name
mallardduck Sep 23, 2024
a24395e
Update readme docs
mallardduck Sep 23, 2024
43c4e68
Only trigger hl-e2e on push to paths related to helm-locker
mallardduck Sep 23, 2024
6cc146b
Test better image tags
mallardduck Sep 23, 2024
e69ff8e
Adjust rancher version annotations
mallardduck Sep 23, 2024
8f2a52b
update chart maintainer
mallardduck Sep 23, 2024
ec90559
Adjust both charts to use GHCR for images
mallardduck Sep 23, 2024
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
10 changes: 5 additions & 5 deletions .github/workflows/e2e/scripts/create-projecthelmchart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ source $(dirname $0)/entry

cd $(dirname $0)/../../../..

kubectl apply -f ./examples/ci-example.yaml
kubectl apply -f ./examples/helm-project-operator/ci-example.yaml
sleep ${DEFAULT_SLEEP_TIMEOUT_SECONDS};

if ! kubectl get -n cattle-helm-system job/helm-install-project-example-chart-dummy; then
if ! kubectl get -n cattle-helm-system job/helm-install-project-operator-example-chart-dummy; then
echo "ERROR: Helm Install Job for Example Chart was never created after ${KUBECTL_WAIT_TIMEOUT} seconds"
echo "PROJECT HELM CHARTS:"
kubectl get projecthelmchart -n cattle-project-p-example -o yaml
Expand All @@ -21,11 +21,11 @@ if ! kubectl get -n cattle-helm-system job/helm-install-project-example-chart-du
exit 1
fi

if ! kubectl wait --for=condition=complete --timeout="${KUBECTL_WAIT_TIMEOUT}" -n cattle-helm-system job/helm-install-project-example-chart-dummy; then
if ! kubectl wait --for=condition=complete --timeout="${KUBECTL_WAIT_TIMEOUT}" -n cattle-helm-system job/helm-install-project-operator-example-chart-dummy; then
echo "ERROR: Helm Install Job for Example Chart never completed after ${KUBECTL_WAIT_TIMEOUT} seconds"
kubectl logs job/helm-install-project-example-chart-dummy -n cattle-helm-system
kubectl logs job/helm-install-project-operator-example-chart-dummy -n cattle-helm-system
exit 1
fi
kubectl logs job/helm-install-project-example-chart-dummy -n cattle-helm-system
kubectl logs job/helm-install-project-operator-example-chart-dummy -n cattle-helm-system

echo "PASS: Adding ProjectHelmChart successfully installed Example Chart"
10 changes: 5 additions & 5 deletions .github/workflows/e2e/scripts/delete-projecthelmchart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ source $(dirname $0)/entry

cd $(dirname $0)/../../../..

kubectl delete -f ./examples/ci-example.yaml
if kubectl get -n cattle-helm-system job/helm-delete-project-example-chart-dummy --ignore-not-found; then
if ! kubectl wait --for=condition=complete --timeout="${KUBECTL_WAIT_TIMEOUT}" -n cattle-helm-system job/helm-delete-project-example-chart-dummy; then
kubectl delete -f ./examples/helm-project-operator/ci-example.yaml
if kubectl get -n cattle-helm-system job/helm-delete-project-operator-example-chart-dummy --ignore-not-found; then
if ! kubectl wait --for=condition=complete --timeout="${KUBECTL_WAIT_TIMEOUT}" -n cattle-helm-system job/helm-delete-project-operator-example-chart-dummy; then
echo "ERROR: Helm Uninstall Job for Example Chart never completed after ${KUBECTL_WAIT_TIMEOUT}"
kubectl logs job/helm-delete-project-example-chart-dummy -n cattle-helm-system
kubectl logs job/helm-delete-project-operator-example-chart-dummy -n cattle-helm-system
exit 1
fi
fi

echo "PASS: Removing ProjectHelmChart successfully uninstalled Example Chart"
echo "PASS: Removing ProjectHelmChart successfully uninstalled Example Chart"
17 changes: 17 additions & 0 deletions .github/workflows/e2e/scripts/install-k3d.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -e
set -x

K3D_URL=https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh
DEFAULT_K3D_VERSION=v5.4.6

install_k3d(){
local k3dVersion=${K3D_VERSION:-${DEFAULT_K3D_VERSION}}
echo -e "Downloading k3d@${k3dVersion} see: ${K3D_URL}"
curl --silent --fail ${K3D_URL} | TAG=${k3dVersion} bash
}

install_k3d

k3d version
23 changes: 23 additions & 0 deletions .github/workflows/hl-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "[helm-locker] CI"

on:
pull_request:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name : Set up Go
uses : actions/setup-go@v5
with:
go-version: 1.22
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run CI
run: BUILD_TARGET=helm-locker make ci
50 changes: 50 additions & 0 deletions .github/workflows/hl-e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: "[helm-locker] CI-e2e"

on:
pull_request:
push:
branches:
- main
paths:
- 'go.mod'
- 'charts/helm-locker*/**'
- 'crds/helm-locker/**'
- 'package/Dockerfile-helm-locker'
- 'cmd/helm-locker/**'
- 'pkg/helm-locker/**'

env:
CLUSTER_NAME : test-cluster
K3S_VERSION : v1.27.9-k3s1

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name : Set up Go
uses : actions/setup-go@v5
with:
go-version: 1.22
- name : Setup up kubectl
run : |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
- name: Set up k3d
run : ./.github/workflows/e2e/scripts/install-k3d.sh
- name: build
run: BUILD_TARGET=helm-locker make build
- name : Setup cluster
run : CLUSTER_NAME=${{ env.CLUSTER_NAME }} K3S_VERSION=${{ env.K3S_VERSION }} ./scripts/setup-cluster.sh
# temporary hack to run the helm-locker controller in the k3d cluster
- name : run helm-locker
run : |
kubectl create ns cattle-helm-system
./bin/helm-locker &
- name : run e2e tests
run: |
k3d kubeconfig get ${{ env.CLUSTER_NAME }} > kubeconfig.yaml
export KUBECONFIG=$(pwd)/kubeconfig.yaml
cd tests && KUBECONFIG=$KUBECONFIG go test -v -race -timeout 30m ./...
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml → .github/workflows/hpo-ci.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ci
name: "[helm-project-operator] ci"

env:
CGO_ENABLED: 0
Expand Down Expand Up @@ -29,7 +29,7 @@ jobs:
helm version
- name: Perform CI
run : make ci
push-images:
build-images:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -45,7 +45,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: ./package/Dockerfile
file: ./package/Dockerfile-helm-project-operator
push: false
tags: ${{ env.IMAGE }}
platforms: linux/amd64
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: E2E Helm Project Operator
name: "[helm-project-operator] E2E Helm Project Operator"

on:
workflow_dispatch:
Expand Down Expand Up @@ -88,14 +88,19 @@ jobs:

- name: Check if Helm Project Operator is up
run: ./.github/workflows/e2e/scripts/validate-helm-project-operator.sh;

- name: Check if Project Registration Namespace is auto-created on namespace detection
run: ./.github/workflows/e2e/scripts/create-project-namespace.sh;

- name: Deploy Example Chart via ProjectHelmChart CR
run: ./.github/workflows/e2e/scripts/create-projecthelmchart.sh;

- name: Delete Example Chart
run: ./.github/workflows/e2e/scripts/delete-projecthelmchart.sh;

- name: Uninstall Helm Project Operator
run: ./.github/workflows/e2e/scripts/uninstall-helm-project-operator.sh;

- name: Delete k3d cluster
if: always()
run: k3d cluster delete e2e-ci-helm-project-operator
33 changes: 33 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: golangci-lint
on:
pull_request:
paths-ignore:
- 'docs/**'
- '*.md'
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'

permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- run: go generate
- run: make build-chart
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
# Require: The version of golangci-lint to use.
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
version: v1.56
43 changes: 0 additions & 43 deletions .github/workflows/publish-image.yaml

This file was deleted.

66 changes: 66 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: "Publish Images"

on:
push:
tags:
- "v*"

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
push:
name : Build and push helm-locker & Helm-Project-Operator images
runs-on : ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name : Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name : Setup go
uses: actions/setup-go@v5
with:
go-version: 1.22
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name : Build, test & validate
run : BUILD_TARGET=helm-locker make ci
- name: Extract metadata (tags, labels) for helm-locker image
id: meta-locker
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/helm-locker
- name: Build and push helm-locker image
id: push
uses: docker/build-push-action@v5
with:
context: .
file: ./package/Dockerfile-helm-locker
push: true
tags: ${{ steps.meta-locker.outputs.tags }}
labels: ${{ steps.meta-locker.outputs.labels }}
platforms : linux/amd64,linux/arm64
- name: Extract metadata (tags, labels) for Helm-Project-Operator image
id: meta-hpo
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build Helm-Project-Operator image
uses: docker/build-push-action@v5
with:
context: .
file: ./package/Dockerfile-helm-project-operator
push: true
tags: ${{ steps.meta-hpo.outputs.tags }}
labels: ${{ steps.meta-hpo.outputs.labels }}
platforms: linux/amd64,linux/arm64
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/.dapper
/.cache
/bin
!/cmd/helm-project-operator/fs/.gitkeep

Choose a reason for hiding this comment

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

why do we need to keep this dir? Can we recreated it when we need it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah - that's a fair point.
I tend to favor keeping dirs like this around - feels like it keeps things uniform and gives hints to the fact that the dir will be populated as part of a successful build. Not super attached to that though if we think it should just be fully excluded.

/cmd/helm-project-operator/fs/*
/dist
*.swp
.idea
/helm-project-operator
/.vscode
/.vscode
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Scan through our [existing issues](https://github.com/rancher/helm-project-opera
- Using the command line:
- [Fork the repo](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo#fork-an-example-repository) so that you can make your changes without affecting the original project until you're ready to merge them.

3. Install or update to **Go 1.17**. For more information, see [the development guide](docs/developing.md).
3. Install or update to **Go 1.17**. For more information, see [the development guide](docs/helm-project-operator/developing.md).

4. Create a working branch and start with your changes!

Expand Down
Loading