mirror of https://github.com/fluxcd/flux2.git
Fix HelmRelease reconciliation when stuck in progress (#3569)
parent
763589cada
commit
a5a8a81a7a
@ -1,3 +0,0 @@
|
|||||||
## Code of Conduct
|
|
||||||
|
|
||||||
FluxCD toolkit follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).
|
|
@ -1,154 +0,0 @@
|
|||||||
# Contributing
|
|
||||||
|
|
||||||
Flux is [Apache 2.0 licensed](https://github.com/fluxcd/flux2/blob/main/LICENSE) and
|
|
||||||
accepts contributions via GitHub pull requests. This document outlines
|
|
||||||
some of the conventions on to make it easier to get your contribution
|
|
||||||
accepted.
|
|
||||||
|
|
||||||
We gratefully welcome improvements to issues and documentation as well as to
|
|
||||||
code.
|
|
||||||
|
|
||||||
## Certificate of Origin
|
|
||||||
|
|
||||||
By contributing to this project you agree to the Developer Certificate of
|
|
||||||
Origin (DCO). This document was created by the Linux Kernel community and is a
|
|
||||||
simple statement that you, as a contributor, have the legal right to make the
|
|
||||||
contribution.
|
|
||||||
|
|
||||||
We require all commits to be signed. By signing off with your signature, you
|
|
||||||
certify that you wrote the patch or otherwise have the right to contribute the
|
|
||||||
material by the rules of the [DCO](DCO):
|
|
||||||
|
|
||||||
`Signed-off-by: Jane Doe <jane.doe@example.com>`
|
|
||||||
|
|
||||||
The signature must contain your real name
|
|
||||||
(sorry, no pseudonyms or anonymous contributions)
|
|
||||||
If your `user.name` and `user.email` are configured in your Git config,
|
|
||||||
you can sign your commit automatically with `git commit -s`.
|
|
||||||
|
|
||||||
## Communications
|
|
||||||
|
|
||||||
For realtime communications we use Slack: To join the conversation, simply
|
|
||||||
join the [CNCF](https://slack.cncf.io/) Slack workspace and use the
|
|
||||||
[#flux-contributors](https://cloud-native.slack.com/messages/flux-contributors/) channel.
|
|
||||||
|
|
||||||
To discuss ideas and specifications we use [Github
|
|
||||||
Discussions](https://github.com/fluxcd/flux2/discussions).
|
|
||||||
|
|
||||||
For announcements we use a mailing list as well. Simply subscribe to
|
|
||||||
[flux-dev on cncf.io](https://lists.cncf.io/g/cncf-flux-dev)
|
|
||||||
to join the conversation (there you can also add calendar invites
|
|
||||||
to your Google calendar for our [Flux
|
|
||||||
meeting](https://docs.google.com/document/d/1l_M0om0qUEN_NNiGgpqJ2tvsF2iioHkaARDeh6b70B0/view)).
|
|
||||||
|
|
||||||
## Understanding Flux and the GitOps Toolkit
|
|
||||||
|
|
||||||
If you are entirely new to Flux and the GitOps Toolkit,
|
|
||||||
you might want to take a look at the [introductory talk and demo](https://www.youtube.com/watch?v=qQBtSkgl7tI).
|
|
||||||
|
|
||||||
This project is composed of:
|
|
||||||
|
|
||||||
- [flux2](https://github.com/fluxcd/flux2): The Flux CLI
|
|
||||||
- [source-manager](https://github.com/fluxcd/source-controller): Kubernetes operator for managing sources (Git and Helm repositories, S3-compatible Buckets)
|
|
||||||
- [kustomize-controller](https://github.com/fluxcd/kustomize-controller): Kubernetes operator for building GitOps pipelines with Kustomize
|
|
||||||
- [helm-controller](https://github.com/fluxcd/helm-controller): Kubernetes operator for building GitOps pipelines with Helm
|
|
||||||
- [notification-controller](https://github.com/fluxcd/notification-controller): Kubernetes operator for handling inbound and outbound events
|
|
||||||
- [image-reflector-controller](https://github.com/fluxcd/image-reflector-controller): Kubernetes operator for scanning container registries
|
|
||||||
- [image-automation-controller](https://github.com/fluxcd/image-automation-controller): Kubernetes operator for patches container image tags in Git
|
|
||||||
|
|
||||||
### Understanding the code
|
|
||||||
|
|
||||||
To get started with developing controllers, you might want to review
|
|
||||||
[our guide](https://fluxcd.io/flux/gitops-toolkit/source-watcher/) which
|
|
||||||
walks you through writing a short and concise controller that watches out
|
|
||||||
for source changes.
|
|
||||||
|
|
||||||
## How to run the test suite
|
|
||||||
|
|
||||||
Prerequisites:
|
|
||||||
|
|
||||||
* go >= 1.24
|
|
||||||
* kubectl >= 1.30
|
|
||||||
* kustomize >= 5.0
|
|
||||||
* coreutils (on Mac OS)
|
|
||||||
|
|
||||||
Install the [controller-runtime/envtest](https://github.com/kubernetes-sigs/controller-runtime/tree/master/tools/setup-envtest) binaries with:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
make install-envtest
|
|
||||||
```
|
|
||||||
|
|
||||||
Then you can run the unit tests with:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
make test
|
|
||||||
```
|
|
||||||
|
|
||||||
After [installing Kubernetes kind](https://kind.sigs.k8s.io/docs/user/quick-start#installation) on your machine,
|
|
||||||
create a cluster for testing with:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
make setup-kind
|
|
||||||
```
|
|
||||||
|
|
||||||
Then you can run the end-to-end tests with:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
make e2e
|
|
||||||
```
|
|
||||||
|
|
||||||
When the output of the Flux CLI changes, to automatically update the golden
|
|
||||||
files used in the test, pass `-update` flag to the test as:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
make e2e TEST_ARGS="-update"
|
|
||||||
```
|
|
||||||
|
|
||||||
Since not all packages use golden files for testing, `-update` argument must be
|
|
||||||
passed only for the packages that use golden files. Use the variables
|
|
||||||
`TEST_PKG_PATH` for unit tests and `E2E_TEST_PKG_PATH` for e2e tests, to set the
|
|
||||||
path of the target test package:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Unit test
|
|
||||||
make test TEST_PKG_PATH="./cmd/flux" TEST_ARGS="-update"
|
|
||||||
# e2e test
|
|
||||||
make e2e E2E_TEST_PKG_PATH="./cmd/flux" TEST_ARGS="-update"
|
|
||||||
```
|
|
||||||
|
|
||||||
Teardown the e2e environment with:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
make cleanup-kind
|
|
||||||
```
|
|
||||||
|
|
||||||
## Acceptance policy
|
|
||||||
|
|
||||||
These things will make a PR more likely to be accepted:
|
|
||||||
|
|
||||||
- a well-described requirement
|
|
||||||
- tests for new code
|
|
||||||
- tests for old code!
|
|
||||||
- new code and tests follow the conventions in old code and tests
|
|
||||||
- a good commit message (see below)
|
|
||||||
- all code must abide [Go Code Review Comments](https://github.com/golang/go/wiki/CodeReviewComments)
|
|
||||||
- names should abide [What's in a name](https://talks.golang.org/2014/names.slide#1)
|
|
||||||
- code must build on both Linux and Darwin, via plain `go build`
|
|
||||||
- code should have appropriate test coverage and tests should be written
|
|
||||||
to work with `go test`
|
|
||||||
|
|
||||||
In general, we will merge a PR once one maintainer has endorsed it.
|
|
||||||
For substantial changes, more people may become involved, and you might
|
|
||||||
get asked to resubmit the PR or divide the changes into more than one PR.
|
|
||||||
|
|
||||||
### Format of the Commit Message
|
|
||||||
|
|
||||||
For the GitOps Toolkit controllers we prefer the following rules for good commit messages:
|
|
||||||
|
|
||||||
- Limit the subject to 50 characters and write as the continuation
|
|
||||||
of the sentence "If applied, this commit will ..."
|
|
||||||
- Explain what and why in the body, if more than a trivial change;
|
|
||||||
wrap it at 72 characters.
|
|
||||||
|
|
||||||
The [following article](https://chris.beams.io/posts/git-commit/#seven-rules)
|
|
||||||
has some more helpful advice on documenting your work.
|
|
@ -1,101 +0,0 @@
|
|||||||
# Flux version 2
|
|
||||||
|
|
||||||
[](https://github.com/fluxcd/flux2/releases)
|
|
||||||
[](https://bestpractices.coreinfrastructure.org/projects/4782)
|
|
||||||
[](https://scorecard.dev/viewer/?uri=github.com/fluxcd/flux2)
|
|
||||||
[](https://app.fossa.com/projects/custom%2B162%2Fgithub.com%2Ffluxcd%2Fflux2?ref=badge_shield)
|
|
||||||
[](https://artifacthub.io/packages/helm/fluxcd-community/flux2)
|
|
||||||
[](https://fluxcd.io/flux/security/slsa-assessment)
|
|
||||||
|
|
||||||
Flux is a tool for keeping Kubernetes clusters in sync with sources of
|
|
||||||
configuration (like Git repositories and OCI artifacts),
|
|
||||||
and automating updates to configuration when there is new code to deploy.
|
|
||||||
|
|
||||||
Flux version 2 ("v2") is built from the ground up to use Kubernetes'
|
|
||||||
API extension system, and to integrate with Prometheus and other core
|
|
||||||
components of the Kubernetes ecosystem. In version 2, Flux supports
|
|
||||||
multi-tenancy and support for syncing an arbitrary number of Git
|
|
||||||
repositories, among other long-requested features.
|
|
||||||
|
|
||||||
Flux v2 is constructed with the [GitOps Toolkit](#gitops-toolkit), a
|
|
||||||
set of composable APIs and specialized tools for building Continuous
|
|
||||||
Delivery on top of Kubernetes.
|
|
||||||
|
|
||||||
Flux is a Cloud Native Computing Foundation ([CNCF](https://www.cncf.io/)) graduated project, used in
|
|
||||||
production by various [organisations](https://fluxcd.io/adopters) and [cloud providers](https://fluxcd.io/ecosystem).
|
|
||||||
|
|
||||||
## Quickstart and documentation
|
|
||||||
|
|
||||||
To get started check out this [guide](https://fluxcd.io/flux/get-started/)
|
|
||||||
on how to bootstrap Flux on Kubernetes and deploy a sample application in a GitOps manner.
|
|
||||||
|
|
||||||
For more comprehensive documentation, see the following guides:
|
|
||||||
- [Ways of structuring your repositories](https://fluxcd.io/flux/guides/repository-structure/)
|
|
||||||
- [Manage Helm Releases](https://fluxcd.io/flux/guides/helmreleases/)
|
|
||||||
- [Automate image updates to Git](https://fluxcd.io/flux/guides/image-update/)
|
|
||||||
- [Manage Kubernetes secrets with Flux and SOPS](https://fluxcd.io/flux/guides/mozilla-sops/)
|
|
||||||
|
|
||||||
If you need help, please refer to our **[Support page](https://fluxcd.io/support/)**.
|
|
||||||
|
|
||||||
## GitOps Toolkit
|
|
||||||
|
|
||||||
The GitOps Toolkit is the set of APIs and controllers that make up the
|
|
||||||
runtime for Flux v2. The APIs comprise Kubernetes custom resources,
|
|
||||||
which can be created and updated by a cluster user, or by other
|
|
||||||
automation tooling.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
You can use the toolkit to extend Flux, or to build your own systems
|
|
||||||
for continuous delivery -- see [the developer
|
|
||||||
guides](https://fluxcd.io/flux/gitops-toolkit/source-watcher/).
|
|
||||||
|
|
||||||
### Components
|
|
||||||
|
|
||||||
- [Source Controller](https://fluxcd.io/flux/components/source/)
|
|
||||||
- [GitRepository CRD](https://fluxcd.io/flux/components/source/gitrepositories/)
|
|
||||||
- [OCIRepository CRD](https://fluxcd.io/flux/components/source/ocirepositories/)
|
|
||||||
- [HelmRepository CRD](https://fluxcd.io/flux/components/source/helmrepositories/)
|
|
||||||
- [HelmChart CRD](https://fluxcd.io/flux/components/source/helmcharts/)
|
|
||||||
- [Bucket CRD](https://fluxcd.io/flux/components/source/buckets/)
|
|
||||||
- [Kustomize Controller](https://fluxcd.io/flux/components/kustomize/)
|
|
||||||
- [Kustomization CRD](https://fluxcd.io/flux/components/kustomize/kustomizations/)
|
|
||||||
- [Helm Controller](https://fluxcd.io/flux/components/helm/)
|
|
||||||
- [HelmRelease CRD](https://fluxcd.io/flux/components/helm/helmreleases/)
|
|
||||||
- [Notification Controller](https://fluxcd.io/flux/components/notification/)
|
|
||||||
- [Provider CRD](https://fluxcd.io/flux/components/notification/providers/)
|
|
||||||
- [Alert CRD](https://fluxcd.io/flux/components/notification/alerts/)
|
|
||||||
- [Receiver CRD](https://fluxcd.io/flux/components/notification/receivers/)
|
|
||||||
- [Image Automation Controllers](https://fluxcd.io/flux/components/image/)
|
|
||||||
- [ImageRepository CRD](https://fluxcd.io/flux/components/image/imagerepositories/)
|
|
||||||
- [ImagePolicy CRD](https://fluxcd.io/flux/components/image/imagepolicies/)
|
|
||||||
- [ImageUpdateAutomation CRD](https://fluxcd.io/flux/components/image/imageupdateautomations/)
|
|
||||||
|
|
||||||
## Community
|
|
||||||
|
|
||||||
Need help or want to contribute? Please see the links below. The Flux project is always looking for
|
|
||||||
new contributors and there are a multitude of ways to get involved.
|
|
||||||
|
|
||||||
- Getting Started?
|
|
||||||
- Look at our [Get Started guide](https://fluxcd.io/flux/get-started/) and give us feedback
|
|
||||||
- Need help?
|
|
||||||
- First: Ask questions on our [GH Discussions page](https://github.com/fluxcd/flux2/discussions).
|
|
||||||
- Second: Talk to us in the #flux channel on [CNCF Slack](https://slack.cncf.io/).
|
|
||||||
- Please follow our [Support Guidelines](https://fluxcd.io/support/)
|
|
||||||
(in short: be nice, be respectful of volunteers' time, understand that maintainers and
|
|
||||||
contributors cannot respond to all DMs, and keep discussions in the public #flux channel as much as possible).
|
|
||||||
- Have feature proposals or want to contribute?
|
|
||||||
- Propose features on our [GitHub Discussions page](https://github.com/fluxcd/flux2/discussions).
|
|
||||||
- Join our upcoming dev meetings ([meeting access and agenda](https://docs.google.com/document/d/1l_M0om0qUEN_NNiGgpqJ2tvsF2iioHkaARDeh6b70B0/view)).
|
|
||||||
- [Join the flux-dev mailing list](https://lists.cncf.io/g/cncf-flux-dev).
|
|
||||||
- Check out [how to contribute](CONTRIBUTING.md) to the project.
|
|
||||||
- Check out the [project roadmap](https://fluxcd.io/roadmap/).
|
|
||||||
|
|
||||||
### Events
|
|
||||||
|
|
||||||
Check out our **[events calendar](https://fluxcd.io/#calendar)**,
|
|
||||||
both with upcoming talks, events and meetings you can attend.
|
|
||||||
Or view the **[resources section](https://fluxcd.io/resources)**
|
|
||||||
with past events videos you can watch.
|
|
||||||
|
|
||||||
We look forward to seeing you with us!
|
|
@ -1,44 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
echo "Creating manifest files in cmd/flux directory for go:embed..."
|
|
||||||
|
|
||||||
# Create manifests directory inside cmd/flux
|
|
||||||
mkdir -p cmd/flux/manifests
|
|
||||||
mkdir -p cmd/flux/manifests/subdir
|
|
||||||
|
|
||||||
# Create a placeholder.yaml file in cmd/flux/manifests directory
|
|
||||||
cat > cmd/flux/manifests/placeholder.yaml << 'EOF'
|
|
||||||
# This is a placeholder file for the go:embed directive
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: flux-placeholder
|
|
||||||
namespace: flux-system
|
|
||||||
data:
|
|
||||||
placeholder: "true"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Create another placeholder in a subdirectory
|
|
||||||
cat > cmd/flux/manifests/subdir/placeholder.yaml << 'EOF'
|
|
||||||
# This is a placeholder file in a subdirectory for the go:embed directive
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: flux-subdir-placeholder
|
|
||||||
namespace: flux-system
|
|
||||||
data:
|
|
||||||
placeholder: "true"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo "Manifest files created successfully in cmd/flux directory."
|
|
||||||
echo "Files in cmd/flux/manifests directory:"
|
|
||||||
find cmd/flux/manifests -type f | sort
|
|
||||||
|
|
||||||
# Remove the problematic fix-embed-issue.go file that has syntax errors
|
|
||||||
if [ -f "fix-embed-issue.go" ]; then
|
|
||||||
echo "Removing problematic fix-embed-issue.go file..."
|
|
||||||
rm fix-embed-issue.go
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Now try running: go test ./..."
|
|
@ -1,23 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# This script creates placeholder manifest files to satisfy
|
|
||||||
# the Go embed directive for testing purposes
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Create the manifests directory if it doesn't exist
|
|
||||||
mkdir -p manifests
|
|
||||||
|
|
||||||
# Create a placeholder manifest file
|
|
||||||
cat > manifests/placeholder.yaml << EOF
|
|
||||||
# This is a placeholder manifest file for tests
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: flux-placeholder
|
|
||||||
namespace: flux-system
|
|
||||||
data:
|
|
||||||
placeholder: "true"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo "Created placeholder manifest files for testing"
|
|
@ -1,39 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
echo "Creating manifest files for go:embed..."
|
|
||||||
|
|
||||||
# Change to the root of the project directory
|
|
||||||
cd "$(git rev-parse --show-toplevel)" || cd "/home/calelin/flux2"
|
|
||||||
|
|
||||||
# Ensure manifests directory exists
|
|
||||||
mkdir -p manifests
|
|
||||||
mkdir -p manifests/subdir
|
|
||||||
|
|
||||||
# Create a placeholder.yaml file in manifests directory
|
|
||||||
cat > manifests/placeholder.yaml << 'EOF'
|
|
||||||
# This is a placeholder file for the go:embed directive
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: flux-placeholder
|
|
||||||
namespace: flux-system
|
|
||||||
data:
|
|
||||||
placeholder: "true"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Create another placeholder in a subdirectory
|
|
||||||
cat > manifests/subdir/placeholder.yaml << 'EOF'
|
|
||||||
# This is a placeholder file in a subdirectory for the go:embed directive
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: flux-subdir-placeholder
|
|
||||||
namespace: flux-system
|
|
||||||
data:
|
|
||||||
placeholder: "true"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo "Manifest files created successfully."
|
|
||||||
echo "Files in manifests directory:"
|
|
||||||
find manifests -type f | sort
|
|
@ -1,92 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# This script creates the necessary manifests for go:embed to work
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
echo "Creating manifest files for testing..."
|
|
||||||
|
|
||||||
# Create manifests in the project root
|
|
||||||
mkdir -p manifests
|
|
||||||
mkdir -p manifests/subdir
|
|
||||||
|
|
||||||
# Create a placeholder.yaml file in the manifests directory
|
|
||||||
cat > manifests/placeholder.yaml << 'EOF'
|
|
||||||
# This is a placeholder file for the go:embed directive
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: flux-placeholder
|
|
||||||
namespace: flux-system
|
|
||||||
data:
|
|
||||||
placeholder: "true"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Create a second placeholder in the manifests directory
|
|
||||||
cat > manifests/dummy.yaml << 'EOF'
|
|
||||||
# This is another placeholder file for the go:embed directive
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: flux-dummy
|
|
||||||
namespace: flux-system
|
|
||||||
data:
|
|
||||||
placeholder: "true"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Create a placeholder in the subdir
|
|
||||||
cat > manifests/subdir/placeholder.yaml << 'EOF'
|
|
||||||
# This is a placeholder file in a subdirectory for the go:embed directive
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: flux-subdir-placeholder
|
|
||||||
namespace: flux-system
|
|
||||||
data:
|
|
||||||
placeholder: "true"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Create manifests in the cmd/flux directory
|
|
||||||
mkdir -p cmd/flux/manifests
|
|
||||||
mkdir -p cmd/flux/manifests/subdir
|
|
||||||
|
|
||||||
# Create a placeholder.yaml file in the cmd/flux/manifests directory
|
|
||||||
cat > cmd/flux/manifests/placeholder.yaml << 'EOF'
|
|
||||||
# This is a placeholder file for the go:embed directive
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: flux-placeholder
|
|
||||||
namespace: flux-system
|
|
||||||
data:
|
|
||||||
placeholder: "true"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Create a second placeholder in the cmd/flux/manifests directory
|
|
||||||
cat > cmd/flux/manifests/dummy.yaml << 'EOF'
|
|
||||||
# This is another placeholder file for the go:embed directive
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: flux-dummy
|
|
||||||
namespace: flux-system
|
|
||||||
data:
|
|
||||||
placeholder: "true"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Create a placeholder in the cmd/flux/manifests/subdir
|
|
||||||
cat > cmd/flux/manifests/subdir/placeholder.yaml << 'EOF'
|
|
||||||
# This is a placeholder file in a subdirectory for the go:embed directive
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: flux-subdir-placeholder
|
|
||||||
namespace: flux-system
|
|
||||||
data:
|
|
||||||
placeholder: "true"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo "Manifest files created successfully."
|
|
||||||
echo "Files in manifests directory:"
|
|
||||||
find manifests -type f | sort
|
|
||||||
echo "Files in cmd/flux/manifests directory:"
|
|
||||||
find cmd/flux/manifests -type f | sort
|
|
@ -1,65 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
echo "Setting up complete test environment for flux2..."
|
|
||||||
|
|
||||||
# Create the manifests directory structure
|
|
||||||
echo "Creating manifests directory structure..."
|
|
||||||
mkdir -p manifests
|
|
||||||
mkdir -p manifests/subdir
|
|
||||||
|
|
||||||
# Create placeholder files
|
|
||||||
echo "Creating placeholder YAML files..."
|
|
||||||
|
|
||||||
cat > manifests/placeholder.yaml << 'EOF'
|
|
||||||
# This is a placeholder file to ensure the Go embed directive can find at least one file
|
|
||||||
# It will be replaced by actual manifests when bundle.sh is run successfully
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: flux-placeholder
|
|
||||||
namespace: flux-system
|
|
||||||
data:
|
|
||||||
placeholder: "true"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
cat > manifests/subdir/another-placeholder.yaml << 'EOF'
|
|
||||||
# This is another placeholder file in a subdirectory
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: flux-placeholder-subdir
|
|
||||||
namespace: flux-system
|
|
||||||
data:
|
|
||||||
placeholder: "true"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Check for necessary tools
|
|
||||||
echo "Checking for required tools..."
|
|
||||||
|
|
||||||
# Check for kubectl
|
|
||||||
if ! command -v kubectl &> /dev/null; then
|
|
||||||
echo "kubectl is not installed. Installing..."
|
|
||||||
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
|
|
||||||
chmod +x kubectl
|
|
||||||
sudo mv kubectl /usr/local/bin/
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check for kustomize
|
|
||||||
if ! command -v kustomize &> /dev/null; then
|
|
||||||
echo "kustomize is not installed. Installing..."
|
|
||||||
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
|
|
||||||
chmod +x kustomize
|
|
||||||
sudo mv kustomize /usr/local/bin/
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if the Go module exists
|
|
||||||
echo "Checking Go modules..."
|
|
||||||
go mod tidy
|
|
||||||
|
|
||||||
# Run a test compile to check for issues
|
|
||||||
echo "Running test compile..."
|
|
||||||
go build -o /dev/null ./cmd/flux
|
|
||||||
|
|
||||||
echo "Test environment setup complete!"
|
|
||||||
echo "You can now run 'go test ./...' to run the tests"
|
|
@ -1,36 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
echo "Creating placeholder YAML files for Go embed directive..."
|
|
||||||
|
|
||||||
# Ensure manifests directory exists
|
|
||||||
mkdir -p manifests
|
|
||||||
mkdir -p manifests/subdir
|
|
||||||
|
|
||||||
# Create the main placeholder.yaml
|
|
||||||
cat > manifests/placeholder.yaml << 'EOF'
|
|
||||||
# This is a placeholder file to ensure the Go embed directive can find at least one file
|
|
||||||
# It will be replaced by actual manifests when bundle.sh is run successfully
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: flux-placeholder
|
|
||||||
namespace: flux-system
|
|
||||||
data:
|
|
||||||
placeholder: "true"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Create a placeholder in a subdirectory
|
|
||||||
cat > manifests/subdir/placeholder.yaml << 'EOF'
|
|
||||||
# This is a placeholder file in a subdirectory
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: flux-subdir-placeholder
|
|
||||||
namespace: flux-system
|
|
||||||
data:
|
|
||||||
placeholder: "true"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo "Placeholder YAML files created successfully."
|
|
||||||
echo "You can now run the tests with: go test ./..."
|
|
@ -1,43 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# This script checks if the placeholder YAML files exist
|
|
||||||
# and creates them if they don't
|
|
||||||
|
|
||||||
echo "Checking for placeholder YAML files..."
|
|
||||||
|
|
||||||
# Ensure the required directories exist
|
|
||||||
mkdir -p manifests
|
|
||||||
mkdir -p manifests/subdir
|
|
||||||
|
|
||||||
# Create placeholder YAML files if they don't exist
|
|
||||||
if [ ! -f "manifests/placeholder.yaml" ]; then
|
|
||||||
echo "Creating manifests/placeholder.yaml..."
|
|
||||||
cat > manifests/placeholder.yaml << 'EOF'
|
|
||||||
# This is a placeholder file to ensure the Go embed directive can find at least one file
|
|
||||||
# It will be replaced by actual manifests when bundle.sh is run successfully
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: flux-placeholder
|
|
||||||
namespace: flux-system
|
|
||||||
data:
|
|
||||||
placeholder: "true"
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f "manifests/subdir/placeholder.yaml" ]; then
|
|
||||||
echo "Creating manifests/subdir/placeholder.yaml..."
|
|
||||||
cat > manifests/subdir/placeholder.yaml << 'EOF'
|
|
||||||
# This is a placeholder file in a subdirectory
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: flux-subdir-placeholder
|
|
||||||
namespace: flux-system
|
|
||||||
data:
|
|
||||||
placeholder: "true"
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Placeholder YAML files check complete."
|
|
@ -1,17 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Source directory
|
|
||||||
SOURCE_DIR=$(pwd)
|
|
||||||
|
|
||||||
# Run the fix script first
|
|
||||||
echo "Setting up test environment..."
|
|
||||||
chmod +x ./fix-flux-test-env.sh
|
|
||||||
./fix-flux-test-env.sh
|
|
||||||
|
|
||||||
# Run the tests
|
|
||||||
echo "Running tests..."
|
|
||||||
go test ./...
|
|
||||||
|
|
||||||
# If we get here, the tests passed
|
|
||||||
echo "Tests completed successfully!"
|
|
@ -1,37 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
echo "Setting up test environment for flux2..."
|
|
||||||
|
|
||||||
# Ensure the required directories exist
|
|
||||||
mkdir -p manifests
|
|
||||||
mkdir -p manifests/subdir
|
|
||||||
|
|
||||||
# Create placeholder YAML files
|
|
||||||
echo "Creating placeholder YAML files..."
|
|
||||||
|
|
||||||
cat > manifests/placeholder.yaml << 'EOF'
|
|
||||||
# This is a placeholder file to ensure the Go embed directive can find at least one file
|
|
||||||
# It will be replaced by actual manifests when bundle.sh is run successfully
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: flux-placeholder
|
|
||||||
namespace: flux-system
|
|
||||||
data:
|
|
||||||
placeholder: "true"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
cat > manifests/subdir/placeholder.yaml << 'EOF'
|
|
||||||
# This is a placeholder file in a subdirectory
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: flux-subdir-placeholder
|
|
||||||
namespace: flux-system
|
|
||||||
data:
|
|
||||||
placeholder: "true"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo "Running tests..."
|
|
||||||
go test ./...
|
|
@ -1,38 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
echo "Setting up test environment for flux2..."
|
|
||||||
|
|
||||||
# Create the manifests directory
|
|
||||||
mkdir -p manifests
|
|
||||||
|
|
||||||
# Create placeholder.yaml file
|
|
||||||
cat > manifests/placeholder.yaml << EOF
|
|
||||||
# This is a placeholder file to ensure the Go embed directive can find at least one file
|
|
||||||
# It will be replaced by actual manifests when bundle.sh is run successfully
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: flux-placeholder
|
|
||||||
namespace: flux-system
|
|
||||||
data:
|
|
||||||
placeholder: "true"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Create subdirectories for the pattern matching to work
|
|
||||||
mkdir -p manifests/subdir
|
|
||||||
|
|
||||||
# Create another YAML file in a subdirectory
|
|
||||||
cat > manifests/subdir/another-placeholder.yaml << EOF
|
|
||||||
# This is another placeholder file in a subdirectory
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: flux-placeholder-subdir
|
|
||||||
namespace: flux-system
|
|
||||||
data:
|
|
||||||
placeholder: "true"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo "Test environment set up successfully!"
|
|
||||||
echo "You can now run 'go test ./...' to run the tests"
|
|
Loading…
Reference in New Issue