Skip to content

Commit

Permalink
(refactor): switch the ansible plugin to use github.com/operator-fram…
Browse files Browse the repository at this point in the history
…ework/ansible-operator-plugins, remove ansible code (#6583)

* swap to ansible-operator-plugins for the ansible plugin

Signed-off-by: Bryce Palmer <bpalmer@redhat.com>

* remove ansible logic from the SDK repo

Signed-off-by: Bryce Palmer <bpalmer@redhat.com>

* more ansible reference removals

Signed-off-by: Bryce Palmer <bpalmer@redhat.com>

* go mod tidy

Signed-off-by: Bryce Palmer <bpalmer@redhat.com>

* remove ansible specific steps from release guide

Signed-off-by: Bryce Palmer <bpalmer@redhat.com>

---------

Signed-off-by: Bryce Palmer <bpalmer@redhat.com>
  • Loading branch information
everettraven committed Sep 27, 2023
1 parent 8f24aa5 commit d21ed64
Show file tree
Hide file tree
Showing 228 changed files with 18 additions and 19,513 deletions.
4 changes: 0 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
version: 2
updates:
- package-ecosystem: docker
directory: "/images/ansible-operator"
schedule:
interval: daily
- package-ecosystem: docker
directory: "/images/custom-scorecard-tests"
schedule:
Expand Down
81 changes: 0 additions & 81 deletions .github/workflows/deploy-manual.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
environment: deploy
strategy:
matrix:
id: ["operator-sdk", "helm-operator", "scorecard-test", "ansible-operator"]
id: ["operator-sdk", "helm-operator", "scorecard-test"]
steps:

- name: set up qemu
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/freshen-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
strategy:
matrix:
# TODO(estroz): support scorecard-test-kuttl rebuilds.
id: ["operator-sdk", "ansible-operator", "helm-operator", "scorecard-test"]
id: ["operator-sdk", "helm-operator", "scorecard-test"]
steps:
- name: set up qemu
uses: docker/setup-qemu-action@v2
Expand Down
16 changes: 1 addition & 15 deletions .github/workflows/freshen-images/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ IMAGE_DO=--load
# Space-separated list of git tags.
# The --tags arg can be comma-separated.
TAGS=
# ID of the image, ex. operator-sdk, ansible-operator.
# ID of the image, ex. operator-sdk.
IMAGE_ID=
# Update all images.
FORCE=0
Expand Down Expand Up @@ -78,20 +78,6 @@ git clone https://github.com/operator-framework/operator-sdk.git $tmp
trap "rm -rf $tmp" EXIT
pushd $tmp

case $IMAGE_ID in
ansible-operator)
# ansible-operator has a base image that must be rebuilt in advance if necessary.
# This script will detect that the base is fresh when inspecting ansible-operator's
# Dockerfile and build it.
for i in ${!TAGS[*]}; do
if (($i=0)); then
build_ansible_base ${TAGS[$i]} "$PLATFORMS" true
else
build_ansible_base ${TAGS[$i]} "$PLATFORMS" false
fi
done
;;
esac

# Build the image defined by IMAGE_ID for each tag for a set of platforms.
for i in ${!TAGS[*]}; do
Expand Down
32 changes: 0 additions & 32 deletions .github/workflows/freshen-images/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,38 +48,6 @@ function is_dockerfile_fresh() {
done
}

# Build an image at path ./images/ansible-operator/base.Dockerfile checked out at git tag $1
# for all platforms in $2. Semantics are otherwise the same as build_generic.
function build_ansible_base() {
local tag=$1
local platforms=$2
local buildlatest=$3
local dockerfile=./images/ansible-operator/base.Dockerfile


git checkout refs/tags/$tag
local ansible_base_image_tag=$(grep -oP 'FROM \K(quay\.io/operator-framework/ansible-operator-base:.+)' ./images/ansible-operator/Dockerfile)
# Attempt to get the git ref that built this image from the git_commit image label,
# falling back to parsing it from the image tag, which typically contains a git ref
# as the last hyphen-delimit element.
local ansible_base_git_ref=$(docker inspect --format '{{ index .Config.Labels "git_commit" }}' $ansible_base_image_tag)
if [[ $ansible_base_git_ref == "devel" || $ansible_base_git_ref == "" ]]; then
ansible_base_git_ref=$(echo $ansible_base_image_tag | sed -E 's|.+:.+-(.+)|\1|')
fi
git checkout $ansible_base_git_ref
if is_dockerfile_fresh "$dockerfile"; then
echo "Skipping build of $dockerfile, it is FRESH!"
else
# dockerfile is not fresh, rebuildng image
if $buildlatest; then
echo "Rebuilding image [$ansible_base_image_tag] and latest for [$platforms]"
_buildx --tag $ansible_base_image_tag --tag quay.io/operator-framework/ansible-operator-base:latest --platform "$platforms" --file "$dockerfile" $IMAGE_DO --build-arg GIT_COMMIT=$ansible_base_git_ref ./images/ansible-operator
else
echo "Rebuilding image [$ansible_base_image_tag] for [$platforms]"
_buildx --tag $ansible_base_image_tag --platform "$platforms" --file "$dockerfile" $IMAGE_DO --build-arg GIT_COMMIT=$ansible_base_git_ref ./images/ansible-operator
fi
fi
}

# Build an image at path ./images/$2/Dockerfile checked out at git tag $1
# for all platforms in $3. Tag is assumed to be "v"+semver; the image is tagged
Expand Down
59 changes: 0 additions & 59 deletions .github/workflows/test-ansible.yml

This file was deleted.

10 changes: 0 additions & 10 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,6 @@ builds:
- linux_ppc64le
- linux_s390x

# ansible-operator build steps
- id: ansible-operator
main: ./cmd/ansible-operator
binary: ansible-operator
mod_timestamp: "{{ .CommitTimestamp }}"
asmflags: *build-asmflags
gcflags: *build-gcflags
ldflags: *build-ldflags
targets: *build-targets

# helm-operator build steps
- id: helm-operator
main: ./cmd/helm-operator
Expand Down
28 changes: 9 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SHELL = /bin/bash

# IMAGE_VERSION represents the ansible-operator, helm-operator, and scorecard subproject versions.
# IMAGE_VERSION represents the helm-operator, and scorecard subproject versions.
# This value must be updated to the release tag of the most recent release, a change that must
# occur in the release commit. IMAGE_VERSION will be removed once each subproject that uses this
# version is moved to a separate repo and release process.
Expand Down Expand Up @@ -71,16 +71,16 @@ clean: ## Cleanup build artifacts and tool binaries.
##@ Build

.PHONY: install
install: ## Install operator-sdk, ansible-operator, and helm-operator.
go install $(GO_BUILD_ARGS) ./cmd/{operator-sdk,ansible-operator,helm-operator}
install: ## Install operator-sdk and helm-operator.
go install $(GO_BUILD_ARGS) ./cmd/{operator-sdk,helm-operator}

.PHONY: build
build: ## Build operator-sdk, ansible-operator, and helm-operator.
build: ## Build operator-sdk and helm-operator.
@mkdir -p $(BUILD_DIR)
go build $(GO_BUILD_ARGS) -o $(BUILD_DIR) ./cmd/{operator-sdk,ansible-operator,helm-operator}
go build $(GO_BUILD_ARGS) -o $(BUILD_DIR) ./cmd/{operator-sdk,helm-operator}

.PHONY: build/operator-sdk build/ansible-operator build/helm-operator
build/operator-sdk build/ansible-operator build/helm-operator:
.PHONY: build/operator-sdk build/helm-operator
build/operator-sdk build/helm-operator:
go build $(GO_BUILD_ARGS) -o $(BUILD_DIR)/$(@F) ./cmd/$(@F)

# Build scorecard binaries.
Expand All @@ -92,13 +92,9 @@ build/scorecard-test build/scorecard-test-kuttl build/custom-scorecard-tests:

# Convenience wrapper for building all remotely hosted images.
.PHONY: image-build
IMAGE_TARGET_LIST = operator-sdk helm-operator ansible-operator scorecard-test scorecard-test-kuttl
IMAGE_TARGET_LIST = operator-sdk helm-operator scorecard-test scorecard-test-kuttl
image-build: $(foreach i,$(IMAGE_TARGET_LIST),image/$(i)) ## Build all images.

# Convenience wrapper for building dependency base images.
.PHONY: image-build-base
IMAGE_BASE_TARGET_LIST = ansible-operator
image-build-base: $(foreach i,$(IMAGE_BASE_TARGET_LIST),image-base/$(i)) ## Build all images.

# Build an image.
BUILD_IMAGE_REPO = quay.io/operator-framework
Expand Down Expand Up @@ -159,7 +155,7 @@ TEST_PKGS = $(shell go list ./... | grep -v -E 'github.com/operator-framework/op
test-unit: ## Run unit tests
go test -coverprofile=coverage.out -covermode=count -short $(TEST_PKGS)

e2e_tests := test-e2e-go test-e2e-ansible test-e2e-ansible-molecule test-e2e-helm test-e2e-integration
e2e_tests := test-e2e-go test-e2e-helm test-e2e-integration
e2e_targets := test-e2e $(e2e_tests)
.PHONY: $(e2e_targets)

Expand Down Expand Up @@ -193,12 +189,6 @@ test-e2e-sample-go:: dev-install cluster-create ## Run Memcached Operator Sample
make test-e2e -C ./testdata/go/v3/memcached-operator/
test-e2e-go:: image/custom-scorecard-tests ## Run Go e2e tests
go test ./test/e2e/go -v -ginkgo.v
test-e2e-ansible:: image/ansible-operator ## Run Ansible e2e tests
go test -count=1 ./internal/ansible/proxy/...
go test ./test/e2e/ansible -v -ginkgo.v
test-e2e-ansible-molecule:: install dev-install image/ansible-operator ## Run molecule-based Ansible e2e tests
go run ./hack/generate/samples/molecule/generate.go
./hack/tests/e2e-ansible-molecule.sh
test-e2e-helm:: image/helm-operator ## Run Helm e2e tests
go test ./test/e2e/helm -v -ginkgo.v
test-e2e-integration:: ## Run integration tests
Expand Down
43 changes: 0 additions & 43 deletions cmd/ansible-operator/main.go

This file was deleted.

4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ require (
github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2
github.com/onsi/ginkgo/v2 v2.7.0
github.com/onsi/gomega v1.24.2
github.com/operator-framework/ansible-operator-plugins v1.32.0
github.com/operator-framework/api v0.17.4-0.20230223191600-0131a6301e42
github.com/operator-framework/helm-operator-plugins v0.0.12-0.20230413193425-4632388adc61
github.com/operator-framework/java-operator-plugins v0.7.1-0.20230306190439-0eed476d2b75
github.com/operator-framework/operator-lib v0.11.1-0.20230306195046-28cadc6b6055
github.com/operator-framework/operator-manifest-tools v0.2.3-0.20230227155221-caa8b9e1ab12
github.com/operator-framework/operator-registry v1.28.0
github.com/prometheus/client_golang v1.14.0
github.com/prometheus/client_model v0.3.0
github.com/sergi/go-diff v1.2.0
github.com/sirupsen/logrus v1.9.3
github.com/spf13/afero v1.9.3
Expand Down Expand Up @@ -166,7 +166,6 @@ require (
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b // indirect
github.com/otiai10/copy v1.2.0 // indirect
Expand All @@ -175,6 +174,7 @@ require (
github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/rivo/uniseg v0.4.2 // indirect
Expand Down
Loading

0 comments on commit d21ed64

Please sign in to comment.