Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/actions/gen-install-scripts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,21 @@ 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 && \
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.4.1 && \
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
Expand Down
3 changes: 3 additions & 0 deletions .github/actions/gen-install-scripts/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions .github/actions/gen-install-scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
15 changes: 15 additions & 0 deletions .github/workflows/release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down