You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2022/01/31 08:58:19 UTC
[camel-k] 08/40: Migrate if to full workflow & refactor action outputs
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 0025223d85bb57d0747bf211ba2796d4b0af5c6d
Author: phantomjinx <p....@phantomjinx.co.uk>
AuthorDate: Tue Nov 23 18:25:18 2021 +0000
Migrate if to full workflow & refactor action outputs
* If conditional syntax now added to composite actions so can replace the
interim conditional workaround action with built-in syntax
* Replace action outputs with global environment variables
* Easier to debug as printed in logs
* If actions are if-conditioned to not execute, if already run, then
their outputs will not exist whereas global env vars will. This makes
it possible to retain the env vars while skipping repeated executions
of the same actions
---
.github/.env | 2 +-
.github/actions/conditional | 1 -
.github/actions/e2e-kubernetes/action.yml | 26 ++---
.github/actions/e2e-upgrade/action.yml | 46 ++++-----
.github/actions/kamel-build-binary/action.yml | 13 +--
.github/actions/kamel-build-bundle/action.yaml | 30 +++---
.github/actions/kamel-build/action.yml | 25 +----
.../actions/kamel-config-cluster-custom/action.yml | 96 ++++++++----------
.../actions/kamel-config-cluster-kind/action.yml | 37 +++----
.../actions/kamel-config-cluster-ocp3/action.yml | 44 +++------
.github/actions/kamel-config-cluster/action.yaml | 110 ++++++---------------
.github/actions/kamel-prepare-env/action.yml | 69 ++++---------
.github/workflows/kubernetes.yml | 2 +-
.github/workflows/upgrade.yml | 2 +-
.gitmodules | 4 -
15 files changed, 164 insertions(+), 343 deletions(-)
diff --git a/.github/.env b/.github/.env
index cd5940c..eae28d6 100644
--- a/.github/.env
+++ b/.github/.env
@@ -1 +1 @@
-TEST_PLATFORM_CLUSTER=kind
+TEST_CLUSTER=kind
diff --git a/.github/actions/conditional b/.github/actions/conditional
deleted file mode 160000
index 3fce4b7..0000000
--- a/.github/actions/conditional
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 3fce4b7a3171a839b482306f9fd3aba0c2112a24
diff --git a/.github/actions/e2e-kubernetes/action.yml b/.github/actions/e2e-kubernetes/action.yml
index 1f55653..05b84db 100644
--- a/.github/actions/e2e-kubernetes/action.yml
+++ b/.github/actions/e2e-kubernetes/action.yml
@@ -19,7 +19,7 @@ name: e2e-kubernetes
description: 'End-to-End tests for 80/20 use-cases'
inputs:
- platform-config:
+ cluster-config-data:
description: 'The configuration of the underlying cluster (if cluster-type is custom)'
required: false
@@ -31,40 +31,40 @@ runs:
name: Prepare Test Environment
uses: ./.github/actions/kamel-prepare-env
- - id: configure-platform
+ - id: configure-cluster
name: Configure Platform
uses: ./.github/actions/kamel-config-cluster
with:
- cluster-type: ${{ steps.prepare-env.outputs.cluster-platform }}
- platform-config: ${{ inputs.platform-config }}
+ cluster-type: ${{ env.TEST_CLUSTER }}
+ cluster-config-data: ${{ inputs.cluster-config-data }}
- id: build-kamel
name: Build Kamel
uses: ./.github/actions/kamel-build
with:
- image-registry-push-host: ${{ steps.configure-platform.outputs.image-registry-push-host }}
- image-registry-pull-host: ${{ steps.configure-platform.outputs.image-registry-pull-host }}
- image-namespace: ${{ steps.configure-platform.outputs.image-namespace }}
+ image-registry-push-host: ${{ env.CLUSTER_IMAGE_REGISTRY_PUSH_HOST }}
+ image-registry-pull-host: ${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
+ image-namespace: ${{ env.CLUSTER_IMAGE_NAMESPACE }}
# Builds the bundle if an OLM is available - depends on cluster being tested
- build-bundle: ${{ steps.configure-platform.outputs.olm-available }}
+ build-bundle: ${{ env.CLUSTER_HAS_OLM }}
- id: install-kamel-cluster-setup
name: Install Kamel Cluster Setup
uses: ./.github/actions/kamel-install-cluster-setup
with:
- kube-admin-user-ctx: ${{ steps.configure-platform.outputs.kube-admin-user-ctx }}
+ kube-admin-user-ctx: ${{ env.CLUSTER_KUBE_ADMIN_USER_CTX }}
- id: run-it
name: Run IT
shell: bash
run: |
# Cluster environment
- export CUSTOM_IMAGE=${{ steps.build-kamel.outputs.local-image-name }}
- export CUSTOM_VERSION=${{ steps.build-kamel.outputs.local-image-version }}
+ export CUSTOM_IMAGE=${{ env.BUILD_BINARY_LOCAL_IMAGE_NAME }}
+ export CUSTOM_VERSION=${{ env.BUILD_BINARY_LOCAL_IMAGE_VERSION }}
export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
- export KAMEL_INSTALL_REGISTRY=${{ steps.configure-platform.outputs.image-registry-pull-host }}
- export KAMEL_INSTALL_REGISTRY_INSECURE=${{ steps.configure-platform.outputs.image-registry-insecure }}
+ export KAMEL_INSTALL_REGISTRY=${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
+ export KAMEL_INSTALL_REGISTRY_INSECURE=${{ env.CLUSTER_IMAGE_REGISTRY_INSECURE }}
export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
diff --git a/.github/actions/e2e-upgrade/action.yml b/.github/actions/e2e-upgrade/action.yml
index fb20822..b2516b6 100644
--- a/.github/actions/e2e-upgrade/action.yml
+++ b/.github/actions/e2e-upgrade/action.yml
@@ -19,7 +19,7 @@ name: e2e-upgrade
description: 'End-to-End tests for upgrading to new version'
inputs:
- platform-config:
+ cluster-config-data:
description: 'The configuration of the underlying cluster (if cluster-type is custom)'
required: false
@@ -31,12 +31,12 @@ runs:
name: Prepare Test Environment
uses: ./.github/actions/kamel-prepare-env
- - id: configure-platform
- name: Configure Platform
+ - id: configure-cluster
+ name: Configure Cluster
uses: ./.github/actions/kamel-config-cluster
with:
- cluster-type: ${{ steps.prepare-env.outputs.cluster-platform }}
- platform-config: ${{ inputs.platform-config }}
+ cluster-type: ${{ env.TEST_CLUSTER }}
+ cluster-config-data: ${{ inputs.cluster-config-data }}
require-olm: true
- name: Get Released Kamel CLI
@@ -51,13 +51,13 @@ runs:
fi
#
- # Note: cannot use GITHUB_ENV vars is same script as it was defined
+ # Note: cannot use GITHUB_ENV vars in same script as it was defined
#
export RELEASED_KAMEL_BINARY=/tmp/kamel-${KAMEL_VERSION}
- echo "RELEASED_KAMEL_BINARY=${RELEASED_KAMEL_BINARY}" >> $GITHUB_ENV
mv /tmp/kamel ${RELEASED_KAMEL_BINARY}
if [ $? == 0 ]; then
echo "Info: Kamel version installed: $(${RELEASED_KAMEL_BINARY} version)"
+ echo "E2E_UPGRADE_RELEASED_KAMEL_BINARY=${RELEASED_KAMEL_BINARY}" >> $GITHUB_ENV
else
echo "Error: Failed to install kamel binary ${KAMEL_VERSION}"
exit 1
@@ -67,44 +67,36 @@ runs:
name: Build Kamel
uses: ./.github/actions/kamel-build
with:
- image-registry-push-host: ${{ steps.configure-platform.outputs.image-registry-push-host }}
- image-registry-pull-host: ${{ steps.configure-platform.outputs.image-registry-pull-host }}
- image-namespace: ${{ steps.configure-platform.outputs.image-namespace }}
+ image-registry-push-host: ${{ env.CLUSTER_IMAGE_REGISTRY_PUSH_HOST }}
+ image-registry-pull-host: ${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
+ image-namespace: ${{ env.CLUSTER_IMAGE_NAMESPACE }}
# Builds the bundle if an OLM is available.
- # Since configure-platform requires OLM then this should be true
- build-bundle: ${{ steps.configure-platform.outputs.olm-available }}
- kube-admin-user-ctx: ${{ steps.configure-platform.outputs.kube-admin-user-ctx }}
+ # Since configure-cluster requires OLM then this should be true
+ build-bundle: ${{ env.CLUSTER_HAS_OLM }}
+ kube-admin-user-ctx: ${{ env.CLUSTER_KUBE_ADMIN_USER_CTX }}
- name: Run IT
shell: bash
run: |
# Use the last released Kamel CLI
- export RELEASED_KAMEL_BIN=${{ env.RELEASED_KAMEL_BINARY }}
+ export RELEASED_KAMEL_BIN=${{ env.E2E_UPGRADE_RELEASED_KAMEL_BINARY }}
echo "Kamel version: $(${RELEASED_KAMEL_BIN} version)"
# Configure install options
- export CUSTOM_IMAGE=${{ steps.build-kamel.outputs.local-image-name }}
- export CUSTOM_VERSION=${{ steps.build-kamel.outputs.local-image-version }}
+ export CUSTOM_IMAGE=${{ env.BUILD_BINARY_LOCAL_IMAGE_NAME }}
+ export CUSTOM_VERSION=${{ env.BUILD_BINARY_LOCAL_IMAGE_VERSION }}
export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
- export KAMEL_INSTALL_REGISTRY=${{ steps.configure-platform.outputs.image-registry-pull-host }}
- export KAMEL_INSTALL_REGISTRY_INSECURE=${{ steps.configure-platform.outputs.image-registry-insecure }}
+ export KAMEL_INSTALL_REGISTRY=${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
+ export KAMEL_INSTALL_REGISTRY_INSECURE=${{ env.CLUSTER_IMAGE_REGISTRY_INSECURE }}
# Despite building a bundle we don't want it installed immediately so no OLM_INDEX_BUNDLE var
# Configure test options
export CAMEL_K_PREV_IIB=quay.io/operatorhubio/catalog:latest
- export CAMEL_K_NEW_IIB=${{ steps.build-kamel.outputs.local-image-bundle-index }}
+ export CAMEL_K_NEW_IIB=${{ env.BUILD_BUNDLE_LOCAL_IMAGE_BUNDLE_INDEX }}
export KAMEL_K_TEST_RELEASE_VERSION=$(make get-last-released-version)
export KAMEL_K_TEST_OPERATOR_CURRENT_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
# Then run integration tests
make test-upgrade
-
- - name: Cleanup-Tests
- if: ${{ always() }}
- shell: bash
- run: |
- if [ -n "${{ env.PLATFORM_CONFIG }}" ]; then
- rm -f ${{ env.PLATFORM_CONFIG }}
- fi
diff --git a/.github/actions/kamel-build-binary/action.yml b/.github/actions/kamel-build-binary/action.yml
index 959d26c..e2216fa 100644
--- a/.github/actions/kamel-build-binary/action.yml
+++ b/.github/actions/kamel-build-binary/action.yml
@@ -69,14 +69,5 @@ runs:
# Use the PULL host to ensure the correct image:tag
# is passed into the tests for the deployment to pull from
#
- export LOCAL_IMAGE_NAME=${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k
- echo "::set-output name=local-img-name::$(echo ${LOCAL_IMAGE_NAME})"
- echo "::set-output name=local-img-version::$(make get-version)"
-
-outputs:
- local-image-name:
- description: "Reference of the camel-k image"
- value: ${{ steps.build-operator.outputs.local-img-name }}
- local-image-version:
- description: "Reference of the camel-k image version"
- value: ${{ steps.build-operator.outputs.local-img-version }}
+ echo "BUILD_BINARY_LOCAL_IMAGE_NAME=${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k" >> $GITHUB_ENV
+ echo "BUILD_BINARY_LOCAL_IMAGE_VERSION=$(make get-version)" >> $GITHUB_ENV
diff --git a/.github/actions/kamel-build-bundle/action.yaml b/.github/actions/kamel-build-bundle/action.yaml
index ee2b561..e490b41 100644
--- a/.github/actions/kamel-build-bundle/action.yaml
+++ b/.github/actions/kamel-build-bundle/action.yaml
@@ -94,16 +94,18 @@ runs:
# Use the PULL host to ensure the correct image:tag
# is passed into the tests for the deployment to pull from
#
- export LOCAL_IMAGE_BUNDLE=${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k-bundle:${{ inputs.local-image-version }}
- echo "::set-output name=local-image-bundle::$(echo ${LOCAL_IMAGE_BUNDLE})"
+ echo "BUILD_BUNDLE_LOCAL_IMAGE=${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k-bundle:${{ inputs.local-image-version }}" >> $GITHUB_ENV
- id: install-opm
name: Install opm if required
shell: bash
run: |
- curl -L https://github.com/operator-framework/operator-registry/releases/download/v1.16.1/linux-amd64-opm -o opm
- chmod +x opm
- sudo mv opm /usr/local/bin/
+ if ! command -v opm &> /dev/null
+ then
+ curl -L https://github.com/operator-framework/operator-registry/releases/download/v1.16.1/linux-amd64-opm -o opm
+ chmod +x opm
+ sudo mv opm /usr/local/bin/
+ fi
- id: build-index-image
name: Create New Index Image
@@ -165,11 +167,11 @@ runs:
#
docker tag \
${PUSH_REGISTRY}/${{ inputs.image-namespace }}/camel-k-bundle:${{ inputs.local-image-version }} \
- ${{ steps.build-bundle-image.outputs.local-image-bundle }}
+ ${{ env.BUILD_BUNDLE_LOCAL_IMAGE }}
# Push the bundle image to the registry
#
- docker push ${{ steps.build-bundle-image.outputs.local-image-bundle }}
+ docker push ${{ env.BUILD_BUNDLE_LOCAL_IMAGE }}
fi
#
@@ -177,19 +179,9 @@ runs:
#
opm index add \
-c docker --skip-tls \
- --bundles ${{ steps.build-bundle-image.outputs.local-image-bundle }} \
+ --bundles ${{ env.BUILD_BUNDLE_LOCAL_IMAGE }} \
--from-index quay.io/operatorhubio/catalog:latest \
--tag ${LOCAL_IIB}
docker push ${LOCAL_IIB}
-
- export LOCAL_IIB=${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k-iib:${{ inputs.local-image-version }}
- echo "::set-output name=local-image-bundle-index::$(echo ${LOCAL_IIB})"
-
-outputs:
- local-image-bundle:
- description: "Reference of the camel-k metadata bundle image"
- value: ${{ steps.build-bundle-image.outputs.local-image-bundle }}
- local-image-bundle-index:
- description: "Reference of the camel-k metadata bundle index image"
- value: ${{ steps.build-index-image.outputs.local-image-bundle-index }}
+ echo "BUILD_BUNDLE_LOCAL_IMAGE_BUNDLE_INDEX=${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k-iib:${{ inputs.local-image-version }}" >> $GITHUB_ENV
diff --git a/.github/actions/kamel-build/action.yml b/.github/actions/kamel-build/action.yml
index 8d14efa..1d23a34 100644
--- a/.github/actions/kamel-build/action.yml
+++ b/.github/actions/kamel-build/action.yml
@@ -29,10 +29,6 @@ inputs:
description: 'Namespace in which to store the image'
required: false
default: 'apache'
- install-kamel-binary:
- description: 'Install the kamel binary onto the path'
- required: false
- default: true
make-rules:
description: 'Override the default make rules'
required: false
@@ -52,7 +48,6 @@ runs:
image-registry-pull-host: ${{ inputs.image-registry-pull-host }}
image-namespace: ${{ inputs.image-namespace }}
make-rules: ${{ inputs.make-rules }}
- install-kamel-binary: ${{ inputs.install-kamel-binary }}
#
# By default do not build the image bundle
@@ -60,24 +55,10 @@ runs:
- id: build-kamel-bundle
name: Build Kamel Metadata Bundle
uses: ./.github/actions/kamel-build-bundle
- if: ${{ inputs.build-bundle != true }}
+ if: ${{ inputs.build-bundle == 'true' }}
with:
image-registry-push-host: ${{ inputs.image-registry-push-host }}
image-registry-pull-host: ${{ inputs.image-registry-pull-host }}
image-namespace: ${{ inputs.image-namespace }}
- local-image-name: ${{ steps.build-kamel-binary.outputs.local-image-name }}
- local-image-version: ${{ steps.build-kamel-binary.outputs.local-image-version }}
-
-outputs:
- local-image-name:
- description: "Reference of the camel-k image"
- value: ${{ steps.build-kamel-binary.outputs.local-image-name }}
- local-image-version:
- description: "Reference of the camel-k image version"
- value: ${{ steps.build-kamel-binary.outputs.local-image-version }}
- local-image-bundle:
- description: "Reference of the camel-k metadata bundle image"
- value: ${{ steps.build-kamel-bundle.outputs.local-image-bundle }}
- local-image-bundle-index:
- description: "Reference of the camel-k metadata bundle index image"
- value: ${{ steps.build-kamel-bundle.outputs.local-image-bundle-index }}
+ local-image-name: ${{ env.BUILD_BINARY_LOCAL_IMAGE_NAME }}
+ local-image-version: ${{ env.BUILD_BINARY_LOCAL_IMAGE_VERSION }}
diff --git a/.github/actions/kamel-config-cluster-custom/action.yml b/.github/actions/kamel-config-cluster-custom/action.yml
index dca1939..bb566e2 100644
--- a/.github/actions/kamel-config-cluster-custom/action.yml
+++ b/.github/actions/kamel-config-cluster-custom/action.yml
@@ -18,65 +18,59 @@
name: kamel-config-cluster-custom
description: 'Provides configuration for acessing a custom kubernetes cluster'
+inputs:
+ cluster-config-data:
+ description: 'The JSON configuration of the cluster'
+ required: true
+
runs:
using: "composite"
steps:
- - name: Read platform-config variable to temporary file & override PLATFORM_TYPE if platform config defined
+ - name: Read cluster-config-data variable to temporary file & override CLUSTER_TYPE if cluster config defined
shell: bash
+ if: ${{ env.CLUSTER_CUSTOM_CONFIGURED != 'true' }}
run: |
- if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
- echo "Cluster configuration already performed ... skipping"
- exit 0
- fi
-
- export PLATFORM_CONFIG=/tmp/platform-config.json
+ export CLUSTER_CONFIG_FILE=/tmp/cluster-config.json
- if [ -f ${PLATFORM_CONFIG} ]; then
- rm -f ${PLATFORM_CONFIG}
+ if [ -f ${CLUSTER_CONFIG_FILE} ]; then
+ rm -f ${CLUSTER_CONFIG_FILE}
fi
- touch "${PLATFORM_CONFIG}"
- if [ -z "${{ env.PLATFORM_CONFIG_DATA }}" ]; then
- echo "Error: No PLATFORM_CONFIG_DATA has been defined"
+ touch "${CLUSTER_CONFIG_FILE}"
+ if [ -z "${{ inputs.cluster-config-data }}" ]; then
+ echo "Error: No cluster-config-data parameter has been defined"
exit 1
fi
- cat << EOF > "${PLATFORM_CONFIG}"
- ${{ env.PLATFORM_CONFIG_DATA }}
+ cat << EOF > "${CLUSTER_CONFIG_FILE}"
+ ${{ inputs.cluster-config-data }}
EOF
- if [ ! -f "${PLATFORM_CONFIG}" ]; then
- echo "Error: No file ${PLATFORM_CONFIG} has been created"
+ if [ ! -f "${CLUSTER_CONFIG_FILE}" ]; then
+ echo "Error: No file ${CLUSTER_CONFIG_FILE} has been created"
exit 1
fi
- if [ -s "${PLATFORM_CONFIG}" ]; then
- echo "Info: Platform configuration defined"
- echo "PLATFORM_CONFIG=${PLATFORM_CONFIG}" >> $GITHUB_ENV
+ if [ -s "${CLUSTER_CONFIG_FILE}" ]; then
+ echo "Info: Cluster configuration defined"
+ echo "CLUSTER_CONFIG_FILE=${CLUSTER_CONFIG_FILE}" >> $GITHUB_ENV
else
- echo "Error: No platform configuration defined"
+ echo "Error: No cluster configuration defined"
exit 1
fi
- - name: Platform-config JSON to variables
- uses: ./.github/actions/conditional
+ - name: Cluster config JSON to variables
+ uses: ./.github/actions/json-to-variables
+ if: ${{ env.CLUSTER_CUSTOM_CONFIGURED != 'true' }}
with:
- if: ${{ env.CLUSTER_CONFIGURED != 'true' }}
- step: |
- uses: ./.github/actions/json-to-variables
- with:
- filename: ${{ env.PLATFORM_CONFIG }}
- prefix: 'e2e'
+ filename: ${{ env.CLUSTER_CONFIG_FILE }}
+ prefix: 'e2e'
- id: connect-cluster
name: Connect to cluster
shell: bash
+ if: ${{ env.CLUSTER_CUSTOM_CONFIGURED != 'true' }}
run: |
- if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
- echo "Cluster configuration already performed ... skipping"
- exit 0
- fi
-
if [ -z "${{ env.e2e_kube-config-data }}" ]; then
echo "Error: kube config data property cannot be found"
exit 1
@@ -129,23 +123,15 @@ runs:
- id: info
name: Info
shell: bash
+ if: ${{ env.CLUSTER_CUSTOM_CONFIGURED != 'true' }}
run: |
- if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
- echo "Cluster configuration already performed ... skipping"
- exit 0
- fi
-
kubectl describe nodes
- id: configure-developer-user
name: Configure Developer User
shell: bash
+ if: ${{ env.CLUSTER_CUSTOM_CONFIGURED != 'true' }}
run: |
- if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
- echo "Cluster configuration already performed ... skipping"
- exit 0
- fi
-
# Aggregate pod eviction permission to the default admin role
cat <<EOF | kubectl apply -f -
kind: ClusterRole
@@ -205,35 +191,31 @@ runs:
- id: extract-config
shell: bash
+ if: ${{ env.CLUSTER_CUSTOM_CONFIGURED != 'true' }}
run: |
- if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
- echo "Cluster configuration already performed ... skipping"
- exit 0
- fi
-
- echo "IMAGE_REGISTRY_PUSH_HOST=${{ env.e2e_image-registry-push-host }}" >> $GITHUB_ENV
- echo "IMAGE_REGISTRY_PULL_HOST=${{ env.e2e_image-registry-pull-host }}" >> $GITHUB_ENV
- echo "IMAGE_REGISTRY_INSECURE=${{ env.e2e_image-registry-insecure }}" >> $GITHUB_ENV
+ echo "CLUSTER_IMAGE_REGISTRY_PUSH_HOST=${{ env.e2e_image-registry-push-host }}" >> $GITHUB_ENV
+ echo "CLUSTER_IMAGE_REGISTRY_PULL_HOST=${{ env.e2e_image-registry-pull-host }}" >> $GITHUB_ENV
+ echo "CLUSTER_IMAGE_REGISTRY_INSECURE=${{ env.e2e_image-registry-insecure }}" >> $GITHUB_ENV
#
- # Export the image namespace if defined in the platform config
+ # Export the image namespace if defined in the cluster config
#
if [ -n "${{ env.e2e_image-namespace }}" ]; then
- echo "IMAGE_NAMESPACE=${{ env.e2e_image-namespace }}" >> $GITHUB_ENV
+ echo "CLUSTER_IMAGE_NAMESPACE=${{ env.e2e_image-namespace }}" >> $GITHUB_ENV
fi
#
# Export the context used for admin and user
#
- echo "KUBE_ADMIN_USER_CTX=${{ env.e2e_kube-admin-user-ctx }}" >> $GITHUB_ENV
- echo "KUBE_USER_CTX=${{ env.e2e_kube-user-ctx }}" >> $GITHUB_ENV
+ echo "CLUSTER_KUBE_ADMIN_USER_CTX=${{ env.e2e_kube-admin-user-ctx }}" >> $GITHUB_ENV
+ echo "CLUSTER_KUBE_USER_CTX=${{ env.e2e_kube-user-ctx }}" >> $GITHUB_ENV
#
# Export the flag for olm capability
#
- echo "HAS_OLM=${{ env.e2e_has-olm }}" >> $GITHUB_ENV
+ echo "CLUSTER_HAS_OLM=${{ env.e2e_has-olm }}" >> $GITHUB_ENV
#
# Avoid configuring the cluster repeatedly
#
- echo "CLUSTER_CONFIGURED=true" >> $GITHUB_ENV
+ echo "CLUSTER_CUSTOM_CONFIGURED=true" >> $GITHUB_ENV
diff --git a/.github/actions/kamel-config-cluster-kind/action.yml b/.github/actions/kamel-config-cluster-kind/action.yml
index 7181b36..e680394 100644
--- a/.github/actions/kamel-config-cluster-kind/action.yml
+++ b/.github/actions/kamel-config-cluster-kind/action.yml
@@ -23,53 +23,42 @@ runs:
steps:
- id: install-cluster
name: Install Cluster
- uses: ./.github/actions/conditional
+ uses: container-tools/kind-action@v1
+ if: ${{ env.CLUSTER_KIND_CONFIGURED != 'true' }}
with:
- if: ${{ env.CLUSTER_CONFIGURED != 'true' }}
- step: |
- uses: container-tools/kind-action@v1
- with:
- version: v0.11.0
- node_image: kindest/node:v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad
+ version: v0.11.0
+ node_image: kindest/node:v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad
- id: info
name: Info
shell: bash
+ if: ${{ env.CLUSTER_KIND_CONFIGURED != 'true' }}
run: |
- if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
- echo "Cluster configuration already performed ... skipping"
- exit 0
- fi
-
kubectl cluster-info
kubectl describe nodes
- id: extract-config
shell: bash
+ if: ${{ env.CLUSTER_KIND_CONFIGURED != 'true' }}
run: |
- if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
- echo "Cluster configuration already performed ... skipping"
- exit 0
- fi
-
# Kind has the same interface for both pushing and pulling images in its registry
- echo "IMAGE_REGISTRY_PUSH_HOST=${{ env.KIND_REGISTRY }}" >> $GITHUB_ENV
- echo "IMAGE_REGISTRY_PULL_HOST=${{ env.KIND_REGISTRY }}" >> $GITHUB_ENV
- echo "IMAGE_REGISTRY_INSECURE=true" >> $GITHUB_ENV
+ echo "CLUSTER_IMAGE_REGISTRY_PUSH_HOST=${{ env.KIND_REGISTRY }}" >> $GITHUB_ENV
+ echo "CLUSTER_IMAGE_REGISTRY_PULL_HOST=${{ env.KIND_REGISTRY }}" >> $GITHUB_ENV
+ echo "CLUSTER_IMAGE_REGISTRY_INSECURE=true" >> $GITHUB_ENV
#
# Export the context used for admin and user
# Since kind has no rbac switched on then these can be the same
#
- echo "KUBE_ADMIN_USER_CTX=$(kubectl config current-context)" >> $GITHUB_ENV
- echo "KUBE_USER_CTX=$(kubectl config current-context)" >> $GITHUB_ENV
+ echo "CLUSTER_KUBE_ADMIN_USER_CTX=$(kubectl config current-context)" >> $GITHUB_ENV
+ echo "CLUSTER_KUBE_USER_CTX=$(kubectl config current-context)" >> $GITHUB_ENV
#
# Export the flag for olm capability
#
- echo "HAS_OLM=false" >> $GITHUB_ENV
+ echo "CLUSTER_HAS_OLM=false" >> $GITHUB_ENV
#
# Avoid configuring the cluster repeatedly
#
- echo "CLUSTER_CONFIGURED=true" >> $GITHUB_ENV
+ echo "CLUSTER_KIND_CONFIGURED=true" >> $GITHUB_ENV
diff --git a/.github/actions/kamel-config-cluster-ocp3/action.yml b/.github/actions/kamel-config-cluster-ocp3/action.yml
index 330389d..2be4ca9 100644
--- a/.github/actions/kamel-config-cluster-ocp3/action.yml
+++ b/.github/actions/kamel-config-cluster-ocp3/action.yml
@@ -23,12 +23,8 @@ runs:
steps:
- name: Get OpenShift Client (oc)
shell: bash
+ if: ${{ env.CLUSTER_OCP3_CONFIGURED != 'true' }}
run: |
- if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
- echo "Cluster configuration already performed ... skipping"
- exit 0
- fi
-
export OPENSHIFT_VERSION=v3.11.0
export OPENSHIFT_COMMIT=0cbc58b
export MAVEN_OPTS=-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
@@ -57,12 +53,8 @@ runs:
- id: start-openshift
name: Start OpenShift Cluster
shell: bash
+ if: ${{ env.CLUSTER_OCP3_CONFIGURED != 'true' }}
run: |
- if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
- echo "Cluster configuration already performed ... skipping"
- exit 0
- fi
-
# Figure out this host's IP address
IP_ADDR="$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)"
@@ -76,7 +68,7 @@ runs:
oc login -u system:admin
# Export the context used for admin login
- echo "KUBE_ADMIN_USER_CTX=$(oc config current-context)" >> $GITHUB_ENV
+ echo "CLUSTER_KUBE_ADMIN_USER_CTX=$(oc config current-context)" >> $GITHUB_ENV
# Wait until we have a ready node in openshift
TIMEOUT=0
@@ -100,23 +92,15 @@ runs:
- id: info
name: Info
shell: bash
+ if: ${{ env.CLUSTER_OCP3_CONFIGURED != 'true' }}
run: |
- if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
- echo "Cluster configuration already performed ... skipping"
- exit 0
- fi
-
oc describe nodes
- id: configure-developer-user
name: Configure Developer User
shell: bash
+ if: ${{ env.CLUSTER_OCP3_CONFIGURED != 'true' }}
run: |
- if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
- echo "Cluster configuration already performed ... skipping"
- exit 0
- fi
-
# Aggregate pod eviction permission to the default admin role
cat <<EOF | oc apply -f -
kind: ClusterRole
@@ -202,23 +186,19 @@ runs:
oc login -u developer
# Export the context used for developer login
- echo "KUBE_USER_CTX=$(oc config current-context)" >> $GITHUB_ENV
+ echo "CLUSTER_KUBE_USER_CTX=$(oc config current-context)" >> $GITHUB_ENV
- id: extract-kube-config
shell: bash
+ if: ${{ env.CLUSTER_OCP3_CONFIGURED != 'true' }}
run: |
- if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
- echo "Cluster configuration already performed ... skipping"
- exit 0
- fi
-
- echo "IMAGE_REGISTRY_PUSH_HOST=" >> $GITHUB_ENV
- echo "IMAGE_REGISTRY_PULL_HOST=" >> $GITHUB_ENV
- echo "IMAGE_REGISTRY_INSECURE=false" >> $GITHUB_ENV
- echo "HAS_OLM=true" >> $GITHUB_ENV
+ echo "CLUSTER_IMAGE_REGISTRY_PUSH_HOST=" >> $GITHUB_ENV
+ echo "CLUSTER_IMAGE_REGISTRY_PULL_HOST=" >> $GITHUB_ENV
+ echo "CLUSTER_IMAGE_REGISTRY_INSECURE=false" >> $GITHUB_ENV
+ echo "CLUSTER_HAS_OLM=true" >> $GITHUB_ENV
#
# Avoid configuring the cluster repeatedly
#
- echo "CLUSTER_CONFIGURED=true" >> $GITHUB_ENV
+ echo "CLUSTER_OCP3_CONFIGURED=true" >> $GITHUB_ENV
diff --git a/.github/actions/kamel-config-cluster/action.yaml b/.github/actions/kamel-config-cluster/action.yaml
index 894fb34..7e87850 100644
--- a/.github/actions/kamel-config-cluster/action.yaml
+++ b/.github/actions/kamel-config-cluster/action.yaml
@@ -16,15 +16,15 @@
# ---------------------------------------------------------------------------
name: kamel-config-cluster
-description: 'Delegates to respective cluster action depending on type of requested platform'
+description: 'Delegates to respective cluster action depending on type of requested cluster'
inputs:
cluster-type:
description: 'The type of cluster required: [kind, ocp3, custom]'
required: true
default: 'kind'
- platform-config:
- description: 'The JSON configuration of the platform - required for custom platform type only'
+ cluster-config-data:
+ description: 'The JSON configuration of the cluster - required for custom cluster type only'
required: false
require-olm:
description: 'If OLM is not available by default ensure that it is installed'
@@ -33,79 +33,51 @@ inputs:
runs:
using: "composite"
steps:
- - name: Override platform type if there is a custom platform-config
+ - name: Override cluster type if there is a custom cluster-config
shell: bash
run: |
- if [ -n "${{ inputs.platform-config }}" ]; then
+ if [ -n "${{ inputs.cluster-config-data }}" ]; then
#
- # Have custom platform-config so override platform-type
+ # Have custom cluster-config-data so override cluster-type
#
- echo "PLATFORM_TYPE=custom" >> $GITHUB_ENV
+ echo "CLUSTER_TYPE=custom" >> $GITHUB_ENV
else
- echo "Info: No platform configuration supplied."
- echo "PLATFORM_TYPE=${{ inputs.cluster-type }}" >> $GITHUB_ENV
+ echo "Info: No cluster configuration supplied."
+ echo "CLUSTER_TYPE=${{ inputs.cluster-type }}" >> $GITHUB_ENV
fi
- #
- # TODO
- # Due to lack of if in steps, need to use conditional action which
- # does not currently include output support so have to put all vars
- # as environment vars. When either ChristopherHX or github support allow
- # for alternative then update accordingly.
- #
- id: execute-kind
name: Maybe Execute Kind Cluster
- uses: ./.github/actions/conditional
- with:
- if: ${{ env.PLATFORM_TYPE == 'kind' }}
- step: |
- uses: ./.github/actions/kamel-config-cluster-kind
+ uses: ./.github/actions/kamel-config-cluster-kind
+ if: ${{ env.CLUSTER_TYPE == 'kind' }}
- id: execute-ocp3
name: Maybe Execute Minishift Cluster
- uses: ./.github/actions/conditional
- with:
- if: ${{ env.PLATFORM_TYPE == 'ocp3' }}
- step: |
- uses: ./.github/actions/kamel-config-cluster-ocp3
+ uses: ./.github/actions/kamel-config-cluster-ocp3
+ if: ${{ env.CLUSTER_TYPE == 'ocp3' }}
- id: execute-custom
name: Maybe Execute Custom Cluster
- uses: ./.github/actions/conditional
- env:
- PLATFORM_CONFIG_DATA: ${{ inputs.platform-config }}
+ uses: ./.github/actions/kamel-config-cluster-custom
+ if: ${{ env.CLUSTER_TYPE == 'custom' }}
with:
- if: ${{ env.PLATFORM_TYPE == 'custom' }}
- step: |
- uses: ./.github/actions/kamel-config-cluster-custom
+ cluster-config-data: ${{ inputs.cluster-config-data }}
- id: execute-invalid
name: Execute Invalid Cluster
- uses: ./.github/actions/conditional
- with:
- if: ${{ env.PLATFORM_TYPE != 'kind' && env.PLATFORM_TYPE != 'ocp3' && env.PLATFORM_TYPE != 'custom' }}
- step: |
- shell: bash
- run: |
- echo "Error: Unrecognised platform request for type of cluster. Should be kind, ocp3 or custom."
- exit 1
-
- - id: platform-info
+ if: ${{ env.CLUSTER_TYPE != 'kind' && env.CLUSTER_TYPE != 'ocp3' && env.CLUSTER_TYPE != 'custom' }}
+ shell: bash
+ run: |
+ echo "Error: Unrecognised cluster request for type of cluster. Should be kind, ocp3 or custom."
+ exit 1
+
+ - id: image-namespace
shell: bash
env:
DEFAULT_IMAGE_NAMESPACE: 'apache'
run: |
- echo "::set-output name=image-registry-push-host::$(echo ${{ env.IMAGE_REGISTRY_PUSH_HOST }})"
- echo "::set-output name=image-registry-pull-host::$(echo ${{ env.IMAGE_REGISTRY_PULL_HOST }})"
- echo "::set-output name=image-registry-insecure::$(echo ${{ env.IMAGE_REGISTRY_INSECURE }})"
- echo "::set-output name=kube-admin-user-ctx::$(echo ${{ env.KUBE_ADMIN_USER_CTX }})"
- echo "::set-output name=kube-user-ctx::$(echo ${{ env.KUBE_USER_CTX }})"
- echo "::set-output name=has-olm::$(echo ${{ env.HAS_OLM }})"
-
- if [ -n "${{ env.IMAGE_NAMESPACE }}" ]; then
- echo "::set-output name=image-namespace::$(echo ${{ env.IMAGE_NAMESPACE }})"
- else
- echo "::set-output name=image-namespace::$(echo ${{ env.DEFAULT_IMAGE_NAMESPACE }})"
+ if [ -z "${{ env.CLUSTER_IMAGE_NAMESPACE }}" ]; then
+ echo "CLUSTER_IMAGE_NAMESPACE=apache" >> $GITHUB_ENV
fi
#
@@ -128,17 +100,16 @@ runs:
name: Install OLM
shell: bash
run: |
- if [ "${{ steps.platform-info.outputs.has-olm }}" == "true" ]; then
+ if [ "${{ env.CLUSTER_HAS_OLM }}" == "true" ]; then
# OLM already installed by default
echo "OLM already available in cluster"
- echo "::set-output name=has-olm::$(echo true)"
exit 0
fi
if [ "${{ inputs.require-olm }}" != "true" ]; then
# OLM not explicitly requested
echo "OLM not explicity required for testing"
- echo "::set-output name=has-olm::$(echo false)"
+ echo "CLUSTER_HAS_OLM=false" >> $GITHUB_ENV
exit 0
fi
@@ -152,7 +123,7 @@ runs:
# Need to be admin so switch to the admin context
#
echo "Change to kube admin context"
- kubectl config use-context "${{ steps.platform-info.outputs.kube-admin-user-ctx }}"
+ kubectl config use-context "${{ env.CLUSTER_KUBE_ADMIN_USER_CTX }}"
set +e
echo "Check if OLM is already installed"
@@ -174,27 +145,4 @@ runs:
kubectl config use-context "${ctx}"
echo "Complete"
- echo "::set-output name=has-olm::$(echo true)"
-
-outputs:
- image-registry-push-host:
- description: "Registry for storing images host push interface"
- value: ${{ steps.platform-info.outputs.image-registry-push-host }}
- image-registry-pull-host:
- description: "Registry for storing images host pull interface"
- value: ${{ steps.platform-info.outputs.image-registry-pull-host }}
- image-registry-insecure:
- description: "Whether the image registry requires secure/authenticated access"
- value: ${{ steps.platform-info.outputs.image-registry-insecure }}
- image-namespace:
- description: "Registry namespace for storing images"
- value: ${{ steps.platform-info.outputs.image-namespace }}
- kube-admin-user-ctx:
- description: "The admin user context of the cluster"
- value: ${{ steps.platform-info.outputs.kube-admin-user-ctx }}
- kube-user-ctx:
- description: "The user context of the cluster"
- value: ${{ steps.platform-info.outputs.kube-user-ctx }}
- olm-available:
- description: "Whether an OLM service is available in the cluster"
- value: ${{ steps.install-olm.outputs.has-olm }}
+ echo "CLUSTER_HAS_OLM=true" >> $GITHUB_ENV
diff --git a/.github/actions/kamel-prepare-env/action.yml b/.github/actions/kamel-prepare-env/action.yml
index f3ec458..45871e1 100644
--- a/.github/actions/kamel-prepare-env/action.yml
+++ b/.github/actions/kamel-prepare-env/action.yml
@@ -16,7 +16,7 @@
# ---------------------------------------------------------------------------
name: kamel-prepare-env
-description: 'Initialise the test environment with tools'
+description: 'Initialise the test environment with tools. (Will only run once per workflow)'
runs:
using: "composite"
@@ -28,22 +28,19 @@ runs:
# clean-up since that step removes all docker image in order to
# claim back as much space as possible.
#
+ # Expects env file with following vars:
+ # TEST_CLUSTER
+ #
- id: read-env-file
uses: ./.github/actions/action-dotenv-to-setenv
+ if: ${{ env.KAMEL_PREPARE_ENV != 'true' }}
with:
env-file: .github/.env
- name: Cleanup
shell: bash
+ if: ${{ env.KAMEL_PREPARE_ENV != 'true' }}
run: |
- #
- # Only perform the cleaning once.
- #
- if [ "${{ env.ENV_PREPARED }}" == "true" ]; then
- echo "Cleaning of docker already performed ... skipping"
- exit 0
- fi
-
ls -lart
echo "Initial status:"
df -h
@@ -69,34 +66,21 @@ runs:
df -h
- name: Set up JDK 11
- uses: ./.github/actions/conditional
+ uses: AdoptOpenJDK/install-jdk@v1
+ if: ${{ env.ENV_PREPARED != 'true' }}
with:
- if: ${{ env.ENV_PREPARED != 'true' }}
- step: |
- uses: AdoptOpenJDK/install-jdk@v1
- with:
- version: "11"
+ version: "11"
- name: Set Go
- uses: ./.github/actions/conditional
+ uses: actions/setup-go@v2 # Version 2 adds GOBIN to PATH
+ if: ${{ env.KAMEL_PREPARE_ENV != 'true' }}
with:
- if: ${{ env.ENV_PREPARED != 'true' }}
- step: |
- uses: actions/setup-go@v2 # Version 2 adds GOBIN to PATH
- with:
- go-version: 1.16.x
+ go-version: 1.16.x
- name: (Re-)install kustomize
shell: bash
+ if: ${{ env.KAMEL_PREPARE_ENV != 'true' }}
run: |
- #
- # Only perform the kustomize install once.
- #
- if [ "${{ env.ENV_PREPARED }}" == "true" ]; then
- echo "Install of kustomize already performed ... skipping"
- exit 0
- fi
-
# reinstall kustomize to be always on the same version
sudo rm $(which kustomize)
make kustomize
@@ -109,30 +93,17 @@ runs:
# Install a version of kubectl for generic access to cluster
#
- id: install-kubectl
- uses: ./.github/actions/conditional
+ uses: azure/setup-kubectl@v1
+ if: ${{ env.KAMEL_PREPARE_ENV != 'true' }}
with:
- if: ${{ env.ENV_PREPARED != 'true' }}
- step: |
- uses: azure/setup-kubectl@v1
- with:
- version: 'latest'
+ version: 'latest'
- - id: report-platform
- name: Report Platform
+ - id: complete-action
+ name: Environment Prepared
shell: bash
+ if: ${{ env.KAMEL_PREPARE_ENV != 'true' }}
run : |
- if [ -n "${{ env.TEST_PLATFORM_CLUSTER }}" ]; then
- echo "::set-output name=platform::$(echo ${{ env.TEST_PLATFORM_CLUSTER }})"
- else
- echo "::set-output name=platform::$(echo kind)"
- fi
-
#
# Avoid preparing the environment repeatedly
#
- echo "ENV_PREPARED=true" >> $GITHUB_ENV
-
-outputs:
- cluster-platform:
- description: "Preferred environment set by .env file (default 'kind')"
- value: ${{ steps.report-platform.outputs.platform }}
+ echo "KAMEL_PREPARE_ENV=true" >> $GITHUB_ENV
diff --git a/.github/workflows/kubernetes.yml b/.github/workflows/kubernetes.yml
index fa5b64c..55ce811 100644
--- a/.github/workflows/kubernetes.yml
+++ b/.github/workflows/kubernetes.yml
@@ -62,4 +62,4 @@ jobs:
- name: Execute Tests
uses: ./.github/actions/e2e-kubernetes
with:
- platform-config: ${{ secrets.E2E_PLATFORM_CONFIG }}
+ cluster-config-data: ${{ secrets.E2E_CLUSTER_CONFIG }}
diff --git a/.github/workflows/upgrade.yml b/.github/workflows/upgrade.yml
index 8e77dde..7967dc0 100644
--- a/.github/workflows/upgrade.yml
+++ b/.github/workflows/upgrade.yml
@@ -61,4 +61,4 @@ jobs:
- name: Execute Upgrade Tests
uses: ./.github/actions/e2e-upgrade
with:
- platform-config: ${{ secrets.E2E_PLATFORM_CONFIG }}
+ cluster-config-data: ${{ secrets.E2E_CLUSTER_CONFIG }}
diff --git a/.gitmodules b/.gitmodules
index 2b7101c..237f21a 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -4,10 +4,6 @@
[submodule ".github/actions/changelog"]
path = .github/actions/changelog
url = https://github.com/CharMixer/auto-changelog-action
-[submodule ".github/actions/conditional"]
- path = .github/actions/conditional
- url = https://github.com/ChristopherHX/conditional.git
- branch = 3fce4b7a3171a839b482306f9fd3aba0c2112a24
[submodule ".github/actions/action-dotenv-to-setenv"]
path = .github/actions/action-dotenv-to-setenv
url = https://github.com/c-py/action-dotenv-to-setenv.git