diff --git a/.github/workflows/helm.yml b/.github/workflows/helm.yml index f86a4b2..161d11a 100644 --- a/.github/workflows/helm.yml +++ b/.github/workflows/helm.yml @@ -6,7 +6,6 @@ on: # update this file to trigger helm chart release - 'charts/kubernetes-operator/Chart.yaml' - 'charts/netbird/Chart.yaml' - - 'charts/netbird-operator-config/Chart.yaml' branches: - main diff --git a/.github/workflows/sync-operator-charts.yml b/.github/workflows/sync-operator-charts.yml index bc82445..54ff3c3 100644 --- a/.github/workflows/sync-operator-charts.yml +++ b/.github/workflows/sync-operator-charts.yml @@ -23,36 +23,22 @@ jobs: "https://api.github.com/repos/${UPSTREAM_REPO}/contents/helm/kubernetes-operator/Chart.yaml?ref=${UPSTREAM_BRANCH}" \ | jq -r '.content' | base64 -d | grep '^version:' | awk '{print $2}') - upstream_config_version=$(curl -s \ - -H "Authorization: token $GH_TOKEN" \ - "https://api.github.com/repos/${UPSTREAM_REPO}/contents/helm/netbird-operator-config/Chart.yaml?ref=${UPSTREAM_BRANCH}" \ - | jq -r '.content' | base64 -d | grep '^version:' | awk '{print $2}') - # Fetch local Chart.yaml files local_operator_version=$(curl -s \ -H "Authorization: token $GH_TOKEN" \ "https://api.github.com/repos/${{ github.repository }}/contents/charts/kubernetes-operator/Chart.yaml?ref=main" \ | jq -r '.content' | base64 -d | grep '^version:' | awk '{print $2}') - local_config_version=$(curl -s \ - -H "Authorization: token $GH_TOKEN" \ - "https://api.github.com/repos/${{ github.repository }}/contents/charts/netbird-operator-config/Chart.yaml?ref=main" \ - | jq -r '.content' | base64 -d | grep '^version:' | awk '{print $2}') - echo "upstream_operator_version=$upstream_operator_version" >> "$GITHUB_OUTPUT" - echo "upstream_config_version=$upstream_config_version" >> "$GITHUB_OUTPUT" echo "local_operator_version=$local_operator_version" >> "$GITHUB_OUTPUT" - echo "local_config_version=$local_config_version" >> "$GITHUB_OUTPUT" - if [ "$upstream_operator_version" = "$local_operator_version" ] && \ - [ "$upstream_config_version" = "$local_config_version" ]; then + if [ "$upstream_operator_version" = "$local_operator_version" ]; then echo "changed=false" >> "$GITHUB_OUTPUT" echo "No version changes detected" else echo "changed=true" >> "$GITHUB_OUTPUT" echo "Version changes detected:" echo " kubernetes-operator: $local_operator_version -> $upstream_operator_version" - echo " netbird-operator-config: $local_config_version -> $upstream_config_version" fi - name: Check for existing sync PR @@ -97,13 +83,10 @@ jobs: # Sync charts using rsync --delete to mirror upstream exactly rsync -avc --delete /tmp/upstream/helm/kubernetes-operator/ charts/kubernetes-operator/ - rsync -avc --delete /tmp/upstream/helm/netbird-operator-config/ charts/netbird-operator-config/ # Extract versions operator_version=$(grep '^version:' charts/kubernetes-operator/Chart.yaml | awk '{print $2}') - config_version=$(grep '^version:' charts/netbird-operator-config/Chart.yaml | awk '{print $2}') echo "operator_version=$operator_version" >> "$GITHUB_OUTPUT" - echo "config_version=$config_version" >> "$GITHUB_OUTPUT" # Clean up rm -rf /tmp/upstream @@ -115,7 +98,6 @@ jobs: run: | BRANCH="sync/operator-charts-${{ steps.sync.outputs.upstream_sha }}" OPERATOR_VERSION="${{ steps.sync.outputs.operator_version }}" - CONFIG_VERSION="${{ steps.sync.outputs.config_version }}" # Check if there are actual changes if git diff --quiet && [ -z "$(git ls-files --others --exclude-standard)" ]; then @@ -129,7 +111,7 @@ jobs: # Create branch, commit, and push git checkout -b "$BRANCH" - git add -A charts/kubernetes-operator/ charts/netbird-operator-config/ + git add -A charts/kubernetes-operator/ git commit -m "sync operator charts from upstream (${{ steps.sync.outputs.upstream_sha }})" git push origin "$BRANCH" @@ -140,8 +122,7 @@ jobs: | Chart | Version | |-------|---------| - | kubernetes-operator | ${OPERATOR_VERSION} | - | netbird-operator-config | ${CONFIG_VERSION} |" + | kubernetes-operator | ${OPERATOR_VERSION} |" # Open PR gh pr create \ diff --git a/.github/workflows/test-chart-netbird-operator-config.yaml b/.github/workflows/test-chart-netbird-operator-config.yaml deleted file mode 100644 index 71f3ea2..0000000 --- a/.github/workflows/test-chart-netbird-operator-config.yaml +++ /dev/null @@ -1,64 +0,0 @@ -name: Test netbird-operator-config Chart - -on: - push: - pull_request: - -jobs: - test-e2e: - name: Run on Ubuntu - runs-on: ubuntu-latest - steps: - - name: Clone the code - uses: actions/checkout@v4 - - - name: Install the latest version of kind - run: | - curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64 - chmod +x ./kind - sudo mv ./kind /usr/local/bin/kind - - - name: Verify kind installation - run: kind version - - - name: Create kind cluster - run: kind create cluster - - - name: Install Helm - run: | - curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash - - - name: Verify Helm installation - run: helm version - - - name: Lint Helm Chart - run: | - helm lint ./charts/kubernetes-operator - - - name: Install cert-manager via Helm - run: | - helm repo add jetstack https://charts.jetstack.io - helm repo update - helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --set installCRDs=true - - - name: Wait for cert-manager to be ready - run: | - kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager - kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-cainjector - kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-webhook - - - name: Install Helm chart for project - run: | - helm install test-chart --create-namespace --namespace netbird --set 'operator.image.tag=debug' ./charts/kubernetes-operator - - - name: Check Helm release status - run: | - helm status test-chart --namespace netbird - - - name: Install config chart for project - run: | - helm install test-chart-config --create-namespace --namespace netbird ./charts/netbird-operator-config - - - name: Check config release status - run: | - helm status test-chart-config --namespace netbird