Preflight docker.io/apecloud/kb-cloud-installer:v2.1.31 false #19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: OpenShift Preflight | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| IMAGE: | |
| description: "Preflight check container image (e.g. docker.io/apecloud/kubeblocks:1.0.1-certified)" | |
| required: true | |
| default: '' | |
| SUBMIT: | |
| description: "Submit check container results to Red Hat (default: false)" | |
| type: boolean | |
| required: false | |
| default: false | |
| run-name: Preflight ${{ inputs.IMAGE }} ${{ inputs.SUBMIT }} | |
| env: | |
| PFLT_PYXIS_API_TOKEN: ${{ secrets.REDHAT_API_KEY }} | |
| PFLT_CERTIFICATION_COMPONENT_ID: ${{ secrets.REDHAT_COMPONENT_PID }} | |
| PFLT_VERSION: "1.16.0" | |
| DOCKER_REGISTRY_URL: docker.io | |
| DOCKER_USER: ${{ secrets.DOCKER_REGISTRY_USER }} | |
| DOCKER_PASSWORD: ${{ secrets.DOCKER_REGISTRY_PASSWORD }} | |
| jobs: | |
| preflight: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: install preflight | |
| run: | | |
| PFLT_VERSION=${{ env.PFLT_VERSION }} | |
| wget https://github.com/redhat-openshift-ecosystem/openshift-preflight/releases/download/${PFLT_VERSION}/preflight-linux-amd64 | |
| chmod +x preflight-linux-amd64 | |
| mv preflight-linux-amd64 /usr/local/bin/preflight | |
| preflight version | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ${{ env.DOCKER_REGISTRY_URL }} | |
| username: ${{ env.DOCKER_USER }} | |
| password: ${{ env.DOCKER_PASSWORD }} | |
| - name: preflight check | |
| id: preflight_check | |
| run: | | |
| IMAGE="${{ inputs.IMAGE }}" | |
| preflight_log="preflight_check_container_log.log" | |
| touch ${preflight_log} | |
| preflight check container ${IMAGE} --docker-config=/home/runner/.docker/config.json | tee -a ${preflight_log} | |
| preflight_ret="$( grep "\"passed\": false," ${preflight_log} || true )" | |
| if [[ -n "$preflight_ret" ]]; then | |
| echo "$(tput -T xterm setaf 1)Preflight result: FAILED$(tput -T xterm sgr0)" | |
| echo preflight-check-result=FAILED >> $GITHUB_OUTPUT | |
| exit 1 | |
| else | |
| echo "$(tput -T xterm setaf 2)Preflight result: PASSED$(tput -T xterm sgr0)" | |
| echo preflight-check-result=PASSED >> $GITHUB_OUTPUT | |
| fi | |
| - name: preflight submit | |
| if: ${{ inputs.SUBMIT && steps.preflight_check.outputs.preflight-check-result != 'FAILED' }} | |
| run: | | |
| IMAGE="${{ inputs.IMAGE }}" | |
| preflight check container ${IMAGE} --submit |