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

update ansible operator #6483

72 changes: 11 additions & 61 deletions .github/workflows/deploy-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ on:
ansible_operator_base_tag:
description: ansible-operator-base image tag, ex. "6e1b47e6ca7c507b8ecf197a8edcd412dd64d85d"
required: false
ansible_operator_base_tag_211:
description: ansible-operator-2.11-preview-base image tag, ex. "6e1b47e6ca7c507b8ecf197a8edcd412dd64d85d"
required: false

jobs:
# Build the ansible-operator-base image.
Expand Down Expand Up @@ -36,8 +33,8 @@ jobs:
fetch-depth: 1

# Copied this for 2.11 rather than use a matrix because eventually 2.11 will be default and this will be removed.
- name: create 2.9-base tag
id: base_tag_29
- name: create base tag
id: base_tag
run: |
set -e
IMG=quay.io/${{ github.repository_owner }}/ansible-operator-base
Expand All @@ -48,84 +45,37 @@ jobs:
fi
echo "tag=${IMG}:${TAG}" >> $GITHUB_OUTPUT
echo "git_commit=${GIT_COMMIT}" >> $GITHUB_OUTPUT

- name: create 2.11-base tag
id: base_tag_211
run: |
set -e
IMG=quay.io/${{ github.repository_owner }}/ansible-operator-2.11-preview-base
TAG="${{ github.event.inputs.ansible_operator_base_tag_211 }}"
GIT_COMMIT=$(git rev-parse HEAD)
if [[ "$TAG" == "" ]]; then
TAG="$(git branch --show-current)-${GIT_COMMIT}"
fi
echo "tag=${IMG}:${TAG}" >> $GITHUB_OUTPUT
echo "git_commit=${GIT_COMMIT}" >> $GITHUB_OUTPUT

- name: build and push ansible 2.9 dep image
- name: build and push ansible dep image
uses: docker/build-push-action@v3
with:
file: ./images/ansible-operator/base.Dockerfile
context: ./images/ansible-operator
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x
push: true
tags: ${{ steps.base_tag_29.outputs.tag }}
build-args: |
GIT_COMMIT=${{ steps.base_tag_29.outputs.git_commit }}

- name: build and push ansible 2.11 dep image
uses: docker/build-push-action@v3
with:
file: ./images/ansible-operator-2.11-preview/base.Dockerfile
context: ./images/ansible-operator-2.11-preview
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x
push: true
tags: ${{ steps.base_tag_211.outputs.tag }}
tags: ${{ steps.base_tag.outputs.tag }}
build-args: |
GIT_COMMIT=${{ steps.base_tag_211.outputs.git_commit }}
GIT_COMMIT=${{ steps.base_tag.outputs.git_commit }}

# This change will be staged and committed in the PR pushed below.
# The script below will fail if no change was made.
- name: update base of ansible-operator 2.9
id: update_29
- name: update base of ansible-operator
id: update
run: |
set -ex
sed -i -E 's|FROM quay\.io/operator-framework/ansible-operator-base:.+|FROM ${{ steps.base_tag_29.outputs.tag }}|g' images/ansible-operator/Dockerfile
sed -i -E 's|FROM quay\.io/operator-framework/ansible-operator-base:.+|FROM ${{ steps.base_tag.outputs.tag }}|g' images/ansible-operator/Dockerfile
git diff --exit-code --quiet && echo "Failed to update images/ansible-operator/Dockerfile" && exit 1
REF="${{ github.event.ref }}"
echo "branch_name=${REF##*/}" >> $GITHUB_OUTPUT

- name: create PR for ansible-operator 2.9 Dockerfile
- name: create PR for ansible-operator Dockerfile
uses: peter-evans/create-pull-request@v3
with:
title: "[${{ steps.update_29.outputs.branch_name }}] image(ansible-operator): bump base to ${{ steps.base_tag_29.outputs.tag }}"
title: "[${{ steps.update.outputs.branch_name }}] image(ansible-operator): bump base to ${{ steps.base_tag.outputs.tag }}"
commit-message: |
[${{ steps.update_29.outputs.branch_name }}] image(ansible-operator): bump base to ${{ steps.base_tag_29.outputs.tag }}
[${{ steps.update.outputs.branch_name }}] image(ansible-operator): bump base to ${{ steps.base_tag.outputs.tag }}

Signed-off-by: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
body: "New ansible-operator-base image built by https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
delete-branch: true
branch-suffix: short-commit-hash

# This change will be staged and committed in the PR pushed below.
# The script below will fail if no change was made.
- name: update base of ansible-operator-2.11-preview
id: update_211
run: |
set -ex
sed -i -E 's|FROM quay\.io/operator-framework/ansible-operator-2.11-preview-base:.+|FROM ${{ steps.base_tag_211.outputs.tag }}|g' images/ansible-operator-2.11-preview/Dockerfile
git diff --exit-code --quiet && echo "Failed to update images/ansible-operator-11-preview-base/Dockerfile" && exit 1
REF="${{ github.event.ref }}"
echo "branch_name=${REF##*/}" >> $GITHUB_OUTPUT

- name: create PR for ansible-operator-2.11-preview Dockerfile
uses: peter-evans/create-pull-request@v3
with:
title: "[${{ steps.update_211.outputs.branch_name }}] image(ansible-operator-2.11-preview): bump base to ${{ steps.base_tag_211.outputs.tag }}"
commit-message: |
[${{ steps.update_211.outputs.branch_name }}] image(ansible-operator-2.11-preview): bump base to ${{ steps.base_tag_211.outputs.tag }}

Signed-off-by: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
body: "New ansible-operator-2.11-preview-base image built by https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
delete-branch: true
branch-suffix: short-commit-hash
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
environment: deploy
strategy:
matrix:
id: ["operator-sdk", "helm-operator", "scorecard-test", "ansible-operator", "ansible-operator-2.11-preview"]
id: ["operator-sdk", "helm-operator", "scorecard-test", "ansible-operator"]
steps:

- name: set up qemu
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-ansible.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ jobs:
- run: sudo rm -rf /usr/local/bin/kustomize
- uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.9'
- name: Run test e2e ansible molecule
run: |
env
pip3 install --user --upgrade setuptools pip
pip3 install --user ansible~=2.9.13
pip3 install --user ansible-core~=2.15.0
make test-e2e-ansible-molecule
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ 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 ansible-operator-2.11-preview scorecard-test scorecard-test-kuttl
IMAGE_TARGET_LIST = operator-sdk helm-operator ansible-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 ansible-operator-2.11-preview
IMAGE_BASE_TARGET_LIST = ansible-operator
image-build-base: $(foreach i,$(IMAGE_BASE_TARGET_LIST),image-base/$(i)) ## Build all images.

# Build an image.
Expand Down
46 changes: 46 additions & 0 deletions changelog/fragments/01-ansible-bump.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# entries is a list of entries to include in
# release notes and/or the migration guide
entries:
- description: >
(ansible): Update the `quay.io/operator-framework/ansible-operator` base image to now use Ansible 2.15.0.
Removes pre-installed Python modules that are not required to build and run the `testdata/ansible/memcached-operator` sample.
Updates Python to 3.9 to work with Ansible 2.15.0
kind: "change"
breaking: false

# Migration can be defined to automatically add a section to
# the migration guide. This is required for breaking changes.
migration:
header: Updating an Ansible Operator to use the updated Ansible 2.15.0 image
body: |
1. Update the `FROM` directive in the `Dockerfile` to have a version tag > `v1.30.0`
2. Evaluate your dependency requirements. The change to Ansible 2.15.0 also included removal of some pre-installed Python modules. You may need to update your `Dockerfile` to `pip install` modules required by your operator.
- description: >
(ansible/v1): Updates the `ansible/v1` plugin scaffolding to:
- Remove the `community.kubernetes` collection
- Update the `operator_sdk.util` collection from `v0.4.0` --> `v0.5.0`
- Update the `molecule.yaml` files to work with `molecule v5.1.0`
kind: "change"
breaking: false

# Migration can be defined to automatically add a section to
# the migration guide. This is required for breaking changes.
migration:
header: Upgrading an Ansible Operator project to match the latest `ansible/v1` plugin changes
body: |
1. In the `requirements.yml` file:
- Remove the `community.kubernetes` collection entry
- Update the version of the `operator_sdk.util` collection entry to `v0.5.0`
2. In the `molecule/kind/molecule.yml` and `molecule/default/molecule.yml` files:
- Remove all instances of the `lint` field. For an example of the diff, see: https://github.com/operator-framework/operator-sdk/pull/6483/files#diff-f159b0d7ec17de90f5b5c297ce997254e6ea4001269167be25615c45c489539e
- description: >
(ansible): Remove the `quay.io/operator-framework/ansible-operator-2.11-preview` image. This image will no longer be built after Operator-SDK v1.30.0.
kind: "removal"
breaking: false

# Migration can be defined to automatically add a section to
# the migration guide. This is required for breaking changes.
migration:
header: Migrating away from the `quay.io/operator-framework/ansible-operator-2.11-preview` base image
body: |
1. Update the `FROM` directive in the `Dockerfile` to use the base image `quay.io/operator-framework/ansible-operator:vX.Y.Z` where `vX.Y.Z` is > `v1.30.0`
6 changes: 3 additions & 3 deletions hack/tests/e2e-ansible-molecule.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ set +u; source "${ENVDIR}/bin/activate"; set -u
TMPDIR="$(mktemp -d)"
trap_add "rm -rf $TMPDIR" EXIT
pip3 install pyasn1==0.4.7 pyasn1-modules==0.2.6 idna==2.8 ipaddress==1.0.23
pip3 install cryptography==3.3.2 molecule==3.6.0
pip3 install cryptography molecule==5.1.0
pip3 install ansible-lint yamllint
pip3 install docker openshift==0.12.1 jmespath
ansible-galaxy collection install 'kubernetes.core:==2.2.0'
pip3 install docker kubernetes jmespath
ansible-galaxy collection install 'kubernetes.core:==2.4.0'
ansible-galaxy collection install 'operator_sdk.util:==0.4.0'
ansible-galaxy collection install 'community.docker:==3.4.0'

Expand Down
38 changes: 0 additions & 38 deletions images/ansible-operator-2.11-preview/Dockerfile

This file was deleted.

19 changes: 0 additions & 19 deletions images/ansible-operator-2.11-preview/Pipfile

This file was deleted.

Loading
Loading