diff --git a/.github/actions/gen-install-scripts/Dockerfile b/.github/actions/gen-install-scripts/Dockerfile index 8e0f729988..869fea9211 100644 --- a/.github/actions/gen-install-scripts/Dockerfile +++ b/.github/actions/gen-install-scripts/Dockerfile @@ -5,8 +5,10 @@ ENV KUBECTL_VERSION 1.18.12 # Install RUN curl -L https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl -o /usr/bin/kubectl && \ chmod +x /usr/bin/kubectl + RUN cd /usr/local/bin &&\ curl -L https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh | bash + RUN CONTROLLER_GEN_TMP_DIR=$(mktemp -d) && \ cd $CONTROLLER_GEN_TMP_DIR && \ go mod init tmp && \ @@ -14,6 +16,10 @@ RUN CONTROLLER_GEN_TMP_DIR=$(mktemp -d) && \ rm -rf $CONTROLLER_GEN_TMP_DIR && \ CONTROLLER_GEN=${GOBIN}/controller-gen +RUN curl -LO https://github.com/operator-framework/operator-sdk/releases/download/v1.4.2/operator-sdk_linux_amd64 && \ + chmod +x operator-sdk_linux_amd64 && \ + mv operator-sdk_linux_amd64 /usr/local/bin/operator-sdk + # Copies your code file from your action repository to the filesystem path `/` of the container COPY entrypoint.sh /home/entrypoint.sh RUN chmod +x /home/entrypoint.sh diff --git a/.github/actions/gen-install-scripts/action.yml b/.github/actions/gen-install-scripts/action.yml index 87b3e1d372..78c722e243 100644 --- a/.github/actions/gen-install-scripts/action.yml +++ b/.github/actions/gen-install-scripts/action.yml @@ -4,6 +4,9 @@ inputs: IMAGE_URL: description: "Operator image" required: true + VERSION: + description: "Version of the Operator" + required: true ENV: description: "Kustomize patch name (enviroment configuration patch)" required: true diff --git a/.github/actions/gen-install-scripts/entrypoint.sh b/.github/actions/gen-install-scripts/entrypoint.sh index f9a715a051..5c096b1ff4 100755 --- a/.github/actions/gen-install-scripts/entrypoint.sh +++ b/.github/actions/gen-install-scripts/entrypoint.sh @@ -19,6 +19,7 @@ cd - which kustomize kustomize version + # all-in-one kustomize build --load-restrictor LoadRestrictionsNone "config/release/${INPUT_ENV}/allinone" > "${target_dir}/all-in-one.yaml" echo "Created all-in-one config" @@ -36,4 +37,13 @@ echo "Created namespaced config" # crds cp config/crd/bases/* "${crds_dir}" +# CSV bundle +operator-sdk generate kustomize manifests -q --apis-dir=pkg/api +# We pass the version only for non-dev deployments (it's ok to have "0.0.0" for dev) +if [[ "${INPUT_ENV}" == "dev" ]]; then + kustomize build --load-restrictor LoadRestrictionsNone config/manifests | operator-sdk generate bundle -q --overwrite +else + kustomize build --load-restrictor LoadRestrictionsNone config/manifests | operator-sdk generate bundle -q --overwrite --version "${INPUT_VERSION}" +fi +operator-sdk bundle validate ./bundle diff --git a/.github/workflows/release-branch.yml b/.github/workflows/release-branch.yml index be3b0da67d..e78c8a11e5 100644 --- a/.github/workflows/release-branch.yml +++ b/.github/workflows/release-branch.yml @@ -30,6 +30,7 @@ jobs: uses: ./.github/actions/gen-install-scripts with: IMAGE_URL: ${{ env.DOCKER_RELEASE_REPO }}:${{ env.VERSION }} + VERSION: ${{ env.VERSION }} ENV: prod - name: Create branch and push it @@ -44,6 +45,20 @@ jobs: PATH_TO_COMMIT: "deploy" DESTINATION_BRANCH: "release/${{ env.VERSION }}" + - name: Commit and push bundle directory + uses: ./.github/actions/push-files + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PATH_TO_COMMIT: "bundle" + DESTINATION_BRANCH: "release/${{ env.VERSION }}" + + - name: Commit and push bundle dockerfile + uses: ./.github/actions/push-files + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PATH_TO_COMMIT: "bundle.Dockerfile" + DESTINATION_BRANCH: "release/${{ env.VERSION }}" + - name: Create PR uses: ./.github/actions/create-pr env: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 72469707e3..2ec50ca518 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -97,6 +97,7 @@ jobs: uses: ./.github/actions/gen-install-scripts with: IMAGE_URL: ${{ env.DOCKER_REPO }}:${{ steps.prepare.outputs.tag }} + VERSION: ${{ steps.prepare.outputs.tag }} ENV: dev - name: Set properties