diff --git a/.github/workflows/operators-installer-sripts-runner-pr.yaml b/.github/workflows/operators-installer-sripts-runner-pr.yaml new file mode 100644 index 000000000..1682c8a5d --- /dev/null +++ b/.github/workflows/operators-installer-sripts-runner-pr.yaml @@ -0,0 +1,48 @@ +name: operators-installer-sripts-runner-pr +on: + pull_request: + paths: + - operators-installer-sripts-runner/** + - .github/workflows/operators-installer-sripts-runner-pr.yaml + +# Declare default permissions as read only. +permissions: read-all + +jobs: + build: + env: + context: operators-installer-sripts-runner + image_name: operators-installer-sripts-runner + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 + + - name: Check and verify version.json + id: check_version + uses: redhat-cop/github-actions/get-image-version@cc45c69b6655161f278271cd0c68ddcc1444a3f8 # v4.6 + with: + IMAGE_CONTEXT_DIR: ${{ env.context }} + + - name: Install qemu dependency + run: | + sudo apt-get update + sudo apt-get install -y qemu-user-static + + - name: Build image + uses: redhat-actions/buildah-build@7a95fa7ee0f02d552a32753e7414641a04307056 # v2 + with: + context: ${{ env.context }} + dockerfiles: | + ./${{ env.context }}/Dockerfile + image: ${{ env.image_name }} + platforms: linux/amd64 + oci: true + tags: ${{ steps.check_version.outputs.IMAGE_TAGS }} + + - name: Test image + run: | + echo "Test if python modual intalled: semver" + podman run ${image_name}:${{ steps.check_version.outputs.VERSION }} python -c "import semver" + + echo "Test if python modual intalled: openshift_client" + podman run ${image_name}:${{ steps.check_version.outputs.VERSION }} python -c "import openshift_client" diff --git a/.github/workflows/operators-installer-sripts-runner-publish.yaml b/.github/workflows/operators-installer-sripts-runner-publish.yaml new file mode 100644 index 000000000..c6ed7fbdf --- /dev/null +++ b/.github/workflows/operators-installer-sripts-runner-publish.yaml @@ -0,0 +1,66 @@ +name: operators-installer-sripts-runner-publish +on: + schedule: + - cron: '0 1 * * *' # everyday at 1am + push: + paths: + - operators-installer-sripts-runner/version.json + - .github/workflows/operators-installer-sripts-runner-publish.yaml + +# Declare default permissions as read only. +permissions: read-all + +jobs: + build: + env: + context: operators-installer-sripts-runner + image_name: operators-installer-sripts-runner + runs-on: ubuntu-latest + permissions: + packages: write + steps: + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 + + - name: Get image tags + id: image_tags + uses: redhat-cop/github-actions/get-image-version@cc45c69b6655161f278271cd0c68ddcc1444a3f8 # v4.6 + with: + IMAGE_CONTEXT_DIR: ${{ env.context }} + + - name: Install qemu dependency + run: | + sudo apt-get update + sudo apt-get install -y qemu-user-static + + - name: Build image + id: build_image + uses: redhat-actions/buildah-build@7a95fa7ee0f02d552a32753e7414641a04307056 # v2 + with: + context: ${{ env.context }} + dockerfiles: | + ./${{ env.context }}/Dockerfile + image: ${{ env.image_name }} + platforms: linux/amd64 + tags: "${{ steps.image_tags.outputs.IMAGE_TAGS }}" + + - name: Push to ghcr.io + uses: redhat-actions/push-to-registry@5ed88d269cf581ea9ef6dd6806d01562096bee9c # v2 + if: ${{ !contains(github.ref, 'renovate') }} + with: + image: ${{ steps.build_image.outputs.image }} + registry: ghcr.io/${{ github.repository }} + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + tags: ${{ steps.build_image.outputs.tags }} + + - name: Push to Quay + env: + REGISTRY_URI: ${{ secrets.REGISTRY_URI }} + if: ${{ env.REGISTRY_URI != '' && !contains(github.ref, 'renovate') }} + uses: redhat-actions/push-to-registry@5ed88d269cf581ea9ef6dd6806d01562096bee9c # v2 + with: + image: ${{ steps.build_image.outputs.image }} + registry: ${{ secrets.REGISTRY_URI }}/${{ secrets.REGISTRY_REPOSITORY }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + tags: ${{ steps.build_image.outputs.tags }} diff --git a/operators-installer-sripts-runner/Dockerfile b/operators-installer-sripts-runner/Dockerfile new file mode 100644 index 000000000..34ac43d2b --- /dev/null +++ b/operators-installer-sripts-runner/Dockerfile @@ -0,0 +1,4 @@ +FROM quay.io/openshift/origin-cli:4.20 + +RUN python3 -m ensurepip --upgrade +RUN python3 -m pip install openshift-client semver==2.13.0 diff --git a/operators-installer-sripts-runner/README.md b/operators-installer-sripts-runner/README.md new file mode 100644 index 000000000..200b04a4b --- /dev/null +++ b/operators-installer-sripts-runner/README.md @@ -0,0 +1,22 @@ +# operators-installer-sripts-runner + +A utility image that can be used with the [containers-installer helm chart](https://github.com/redhat-cop/helm-charts/tree/main/charts/operators-installer) + +```yaml +``` + +## Purpose + +Use with the [containers-installer helm chart](https://github.com/redhat-cop/helm-charts/tree/main/charts/operators-installer) to save time by not having to install python packages at runetime everytime an approver or validator job runs. + +sample-vales.yaml +```yaml +installPlanApproverAndVerifyJobsImage: https://quay.io/repository/redhat-cop/operators-installer-sripts-runner +installRequiredPythonLibraries: false + +... +``` + +## Published + +[https://quay.io/repository/redhat-cop/operators-installer-sripts-runner](https://quay.io/repository/redhat-cop/operators-installer-sripts-runner) via [GitHub Workflows](../../.github/workflows/operators-installer-sripts-runner-publish.yaml). diff --git a/operators-installer-sripts-runner/version.json b/operators-installer-sripts-runner/version.json new file mode 100644 index 000000000..99f8d4a02 --- /dev/null +++ b/operators-installer-sripts-runner/version.json @@ -0,0 +1,3 @@ +{ + "version": "v1.0.0" +} \ No newline at end of file