diff --git a/.github/workflows/windows-e2e.yml b/.github/workflows/windows-e2e.yml index 7438c3236e..a61414d004 100644 --- a/.github/workflows/windows-e2e.yml +++ b/.github/workflows/windows-e2e.yml @@ -8,7 +8,7 @@ on: jobs: windows-e2e-ocp: - uses: crc-org/crc/.github/workflows/windows-qe-tpl.yml@main + uses: adrianriobo/crc/.github/workflows/windows-qe-tpl.yml@main strategy: fail-fast: false matrix: @@ -22,7 +22,7 @@ jobs: - qe-type: 'integration' preset: 'microshift' with: - trigger-workflow-id: ${{ github.event.workflow_run.workflow_id }} + trigger-workflow-run-id: ${{ github.event.workflow_run.id }} qe-type: ${{matrix.qe-type}} preset: ${{matrix.preset}} secrets: inherit diff --git a/.github/workflows/windows-qe-tpl.yml b/.github/workflows/windows-qe-tpl.yml index 1cd1e70169..a26ddd1206 100644 --- a/.github/workflows/windows-qe-tpl.yml +++ b/.github/workflows/windows-qe-tpl.yml @@ -5,7 +5,8 @@ name: windows-qe-tpl on: workflow_call: inputs: - trigger-workflow-id: + trigger-workflow-run-id: + description: run-id of the workflow which originate the execution and where the artifacts have been built required: true type: string qe-type: @@ -31,187 +32,26 @@ jobs: steps: - name: Download gh context id: download-gh-context-artifact - uses: dawidd6/action-download-artifact@v3 + uses: actions/download-artifact@v4 with: - workflow: ${{inputs.trigger-workflow-id}} name: gh-context + run-id: ${{inputs.trigger-workflow-run-id}} + github-token: ${{ github.token }} - name: Download windows installer id: download-windows-installer-artifact - uses: dawidd6/action-download-artifact@v3 + uses: actions/download-artifact@v4 with: - workflow: ${{inputs.trigger-workflow-id}} name: windows-installer - + run-id: ${{inputs.trigger-workflow-run-id}} + github-token: ${{ github.token }} + - name: Download qe oci image id: download-qe-oci-image-artifact - uses: dawidd6/action-download-artifact@v3 + uses: actions/download-artifact@v4 with: - workflow: ${{inputs.trigger-workflow-id}} name: crc-${{inputs.qe-type}}-windows-amd64 + run-id: ${{inputs.trigger-workflow-run-id}} + github-token: ${{ github.token }} - - name: Correlate - env: - PULL_SECRET: ${{ secrets.PULL_SECRET }} - run: | - # Get origin commit sha for testing - commit_sha=$(cat gh_context.json | jq -r '.event.after') - if [[ -z "${commit_sha}" ]]; then - # on first PR creation .event.after is empty, then .sha is used as commit instead - commit_sha=$(cat gh_context.json | jq -r '.sha') - fi - echo "commit_sha=${commit_sha}" >> "$GITHUB_ENV" - - # Set status_context - status_context="ci/gh/${{inputs.qe-type}}" - if [[ "${{inputs.qe-type}}" == "e2e" ]]; then - status_context="${status_context}-${{inputs.preset}}" - fi - status_context="${status_context}/windows-${{matrix.windows-version}}-${{matrix.windows-featurepack}}" - echo "status_context=${status_context}" >> "$GITHUB_ENV" - - # Save pull-secret as file - echo "${PULL_SECRET}" > pull-secret - - - name: Add status to the PR check - run: | - set -xuo - # Status msg - data="{\"state\":\"pending\"" - data="${data},\"description\":\"Running ${{inputs.qe-type}}-${{inputs.preset}} on Windows\"" - data="${data},\"context\":\"${{ env.status_context }}\"" - data="${data},\"target_url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}" - # Create status by API call - curl -L -v -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ github.token }}" \ - https://api.github.com/repos/${{ github.repository }}/statuses/${{ env.commit_sha }} \ - -d "${data}" - - - name: Create Windows instance - run: | - # Create instance - podman run -d --name windows-create --rm \ - -v ${PWD}:/workspace:z \ - -e ARM_TENANT_ID=${{secrets.ARM_TENANT_ID}} \ - -e ARM_SUBSCRIPTION_ID=${{secrets.ARM_SUBSCRIPTION_ID}} \ - -e ARM_CLIENT_ID=${{secrets.ARM_CLIENT_ID}} \ - -e ARM_CLIENT_SECRET='${{secrets.ARM_CLIENT_SECRET}}' \ - -e AZURE_STORAGE_ACCOUNT='${{ secrets.AZURE_STORAGE_ACCOUNT }}' \ - -e AZURE_STORAGE_KEY='${{ secrets.AZURE_STORAGE_KEY }}' \ - quay.io/rhqp/qenvs:v0.6.3 azure \ - windows create \ - --project-name 'windows-desktop-${{ matrix.windows-version }}-${{ matrix.windows-featurepack }}-${{inputs.qe-type}}-${{inputs.preset}}' \ - --backed-url azblob://crc-qenvs-state/${{ env.commit_sha }} \ - --conn-details-output '/workspace' \ - --windows-version '${{matrix.windows-version}}' \ - --windows-featurepack '${{matrix.windows-featurepack}}' \ - --tags project=openshift-local,source=github,org=${{github.repository_owner}} \ - --spot - podman logs -f windows-create - - - name: Install CRC on host - run: | - podman run --rm -d --name crc-win-support \ - -e TARGET_HOST=$(cat host) \ - -e TARGET_HOST_USERNAME=$(cat username) \ - -e TARGET_HOST_KEY_PATH=/data/id_rsa \ - -e TARGET_FOLDER=crc-support \ - -e TARGET_CLEANUP='false' \ - -e OUTPUT_FOLDER=/data \ - -e DEBUG='true' \ - -v ${PWD}:/data:z \ - -v ${PWD}/crc-windows-installer.zip:/opt/crc-support/crc-windows-installer.zip:z \ - quay.io/rhqp/crc-support:v0.5-windows crc-support/run.ps1 \ - -targetPath "/Users/$(cat username)/crc-support" \ - -download 'false' \ - -install 'true' \ - -forceFresh 'false' - podman logs -f crc-win-support - - - name: Run CRC ${{inputs.qe-type}} - run: | - # load image - podman load -i crc-${{inputs.qe-type}}-windows-amd64.tar - # run - cmd="crc-qe/run.ps1 -junitFilename crc-${{inputs.qe-type}}-junit.xml -targetFolder crc-qe" - if [[ "${{inputs.qe-type}}" == "e2e" ]]; then - if [[ "${{inputs.preset}}" == "microshift" ]]; then - cmd="${cmd} -e2eTagExpression '@story_microshift'" - else - cmd="${cmd} -e2eTagExpression '~@minimal && ~@story_microshift'" - fi - fi - podman run --rm -d --name crc-${{inputs.qe-type}} \ - -e TARGET_HOST=$(cat host) \ - -e TARGET_HOST_USERNAME=$(cat username) \ - -e TARGET_HOST_KEY_PATH=/data/id_rsa \ - -e TARGET_FOLDER=crc-qe \ - -e TARGET_RESULTS=results \ - -e OUTPUT_FOLDER=/data \ - -e DEBUG=true \ - -v $PWD/pull-secret:/opt/crc/pull-secret:z \ - -v $PWD:/data:z \ - quay.io/crcont/crc-${{inputs.qe-type}}:gh-windows-amd64 \ - ${cmd} - podman logs -f crc-${{inputs.qe-type}} - - - name: Test Report - id: test-report - uses: mikepenz/action-junit-report@v4 - if: always() - with: - fail_on_failure: true - include_passed: true - detailed_summary: true - require_tests: true - report_paths: '**/*.xml' - - - name: Upload ${{inputs.qe-type}} results - uses: actions/upload-artifact@v4 - if: always() - with: - name: windows-${{inputs.qe-type}}-${{inputs.preset}}-${{matrix.windows-version}}${{matrix.windows-featurepack}} - path: | - **/*.xml - **/*.results - **/*.log - - - name: Update status of the PR check - if: always() - run: | - set -xuo - # Status msg - data="{\"state\":\"success\"" - if [[ ${{steps.test-report.outcome}} != "success" ]]; then - data="{\"state\":\"failure\"" - fi - data="${data},\"description\":\"Finished ${{inputs.qe-type}}-${{inputs.preset}} on Windows\"" - data="${data},\"context\":\"${{ env.status_context }}\"" - data="${data},\"target_url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}" - # Create status by API call - curl -L -v -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ github.token }}" \ - https://api.github.com/repos/${{ github.repository }}/statuses/${{ env.commit_sha }} \ - -d "${data}" - - - name: Destroy instance - if: always() - run: | - # Make sure lock is removed - rm -rf .pulumi/locks/* - # Destroy - podman run -d --name windows-destroy --rm \ - -v ${PWD}:/workspace:z \ - -e ARM_TENANT_ID=${{secrets.ARM_TENANT_ID}} \ - -e ARM_SUBSCRIPTION_ID=${{secrets.ARM_SUBSCRIPTION_ID}} \ - -e ARM_CLIENT_ID=${{secrets.ARM_CLIENT_ID}} \ - -e ARM_CLIENT_SECRET='${{secrets.ARM_CLIENT_SECRET}}' \ - -e AZURE_STORAGE_ACCOUNT='${{ secrets.AZURE_STORAGE_ACCOUNT }}' \ - -e AZURE_STORAGE_KEY='${{ secrets.AZURE_STORAGE_KEY }}' \ - quay.io/rhqp/qenvs:v0.6.3 azure \ - windows destroy \ - --project-name 'windows-desktop-${{ matrix.windows-version }}-${{ matrix.windows-featurepack }}-${{inputs.qe-type}}-${{inputs.preset}}' \ - --backed-url azblob://crc-qenvs-state/${{ env.commit_sha }} - podman logs -f windows-destroy + \ No newline at end of file diff --git a/Makefile b/Makefile index b71593cf07..24f445483e 100644 --- a/Makefile +++ b/Makefile @@ -2,12 +2,12 @@ all: install SHELL := /bin/bash -OPENSHIFT_VERSION ?= 4.15.3 +OPENSHIFT_VERSION ?= 4.15.10 PODMAN_VERSION ?= 4.4.4 OKD_VERSION ?= 4.15.0-0.okd-2024-02-23-163410 -MICROSHIFT_VERSION ?= 4.15.3 +MICROSHIFT_VERSION ?= 4.15.9 BUNDLE_EXTENSION = crcbundle -CRC_VERSION = 2.34.1 +CRC_VERSION = 2.35.0 COMMIT_SHA?=$(shell git rev-parse --short=6 HEAD) MACOS_INSTALL_PATH = /usr/local/crc CONTAINER_RUNTIME ?= podman diff --git a/cmd/crc/cmd/root.go b/cmd/crc/cmd/root.go index f257844cab..28d3bab37c 100644 --- a/cmd/crc/cmd/root.go +++ b/cmd/crc/cmd/root.go @@ -61,7 +61,8 @@ func init() { // Initiate segment client if segmentClient, err = segment.NewClient(config, httpproxy.HTTPTransport()); err != nil { - logging.Fatal(err.Error()) + logging.Warn(err.Error()) + logging.Warn("Error during segment client initialization, telemetry will be unavailable in this session") } // subcommands diff --git a/images/build-e2e/Containerfile b/images/build-e2e/Containerfile index 25160ba121..94aaa7634c 100644 --- a/images/build-e2e/Containerfile +++ b/images/build-e2e/Containerfile @@ -1,5 +1,5 @@ -FROM registry.access.redhat.com/ubi9/go-toolset:1.20 AS builder +FROM registry.access.redhat.com/ubi8/go-toolset:1.20 AS builder USER root diff --git a/images/build-integration/Containerfile b/images/build-integration/Containerfile index 6eda99fd71..ca498f963a 100644 --- a/images/build-integration/Containerfile +++ b/images/build-integration/Containerfile @@ -1,5 +1,5 @@ -FROM registry.access.redhat.com/ubi9/go-toolset:1.20 AS builder +FROM registry.access.redhat.com/ubi8/go-toolset:1.20 AS builder USER root diff --git a/images/build-integration/lib/darwin/run.sh b/images/build-integration/lib/darwin/run.sh index 4665cca7f5..d8346eacf1 100755 --- a/images/build-integration/lib/darwin/run.sh +++ b/images/build-integration/lib/darwin/run.sh @@ -32,14 +32,14 @@ done mkdir -p $targetFolder/results # Run tests -PATH="$PATH:${HOME}/$targetFolder/bin" -PULL_SECRET_PATH="${HOME}/$targetFolder/pull-secret" +export PATH="$PATH:${HOME}/$targetFolder/bin" +export PULL_SECRET_PATH="${HOME}/$targetFolder/pull-secret" if [ ! -z "$bundleLocation" ] then - BUNDLE_PATH="$bundleLocation" + export BUNDLE_PATH="$bundleLocation" fi cd $targetFolder/bin -. integration.test > integration.results +./integration.test > integration.results # Copy results cd .. diff --git a/images/build-integration/lib/linux/run.sh b/images/build-integration/lib/linux/run.sh index 4665cca7f5..d8346eacf1 100755 --- a/images/build-integration/lib/linux/run.sh +++ b/images/build-integration/lib/linux/run.sh @@ -32,14 +32,14 @@ done mkdir -p $targetFolder/results # Run tests -PATH="$PATH:${HOME}/$targetFolder/bin" -PULL_SECRET_PATH="${HOME}/$targetFolder/pull-secret" +export PATH="$PATH:${HOME}/$targetFolder/bin" +export PULL_SECRET_PATH="${HOME}/$targetFolder/pull-secret" if [ ! -z "$bundleLocation" ] then - BUNDLE_PATH="$bundleLocation" + export BUNDLE_PATH="$bundleLocation" fi cd $targetFolder/bin -. integration.test > integration.results +./integration.test > integration.results # Copy results cd .. diff --git a/packaging/chocolatey/crc/crc.nuspec.in b/packaging/chocolatey/crc/crc.nuspec.in index 270bc9f11d..7370b50e5a 100755 --- a/packaging/chocolatey/crc/crc.nuspec.in +++ b/packaging/chocolatey/crc/crc.nuspec.in @@ -6,7 +6,7 @@ anjannath CRC - Runs Containers https://github.com/crc-org - https://crc.dev/blog/about + https://crc.dev/blog https://github.com/crc-org/crc/issues https://cdn.statically.io/gh/crc-org/blog/main/static/crc-upstream-logo.png https://github.com/crc-org/crc/blob/main/LICENSE diff --git a/pkg/crc/segment/segment.go b/pkg/crc/segment/segment.go index ee6c0cc594..5426728702 100644 --- a/pkg/crc/segment/segment.go +++ b/pkg/crc/segment/segment.go @@ -39,17 +39,24 @@ type Client struct { identifyHashPath string } +var NoopClient = &Client{} + func NewClient(config *crcConfig.Config, transport http.RoundTripper) (*Client, error) { - return newCustomClient(config, transport, + client, err := newCustomClient(config, transport, filepath.Join(constants.GetHomeDir(), ".redhat", "anonymousId"), filepath.Join(constants.CrcBaseDir, "segmentIdentifyHash"), analytics.DefaultEndpoint) + if err != nil { + // Return empty client (noop client) -- telemetry will not be available + return NoopClient, err + } + return client, nil } func newCustomClient(config *crcConfig.Config, transport http.RoundTripper, telemetryFilePath, identifyHashFilePath, segmentEndpoint string) (*Client, error) { userID, err := getUserIdentity(telemetryFilePath) if err != nil { - return nil, err + return NoopClient, err } client, err := analytics.NewWithConfig(WriteKey, analytics.Config{ Endpoint: segmentEndpoint, @@ -60,12 +67,12 @@ func newCustomClient(config *crcConfig.Config, transport http.RoundTripper, tele Transport: transport, }) if err != nil { - return nil, err + return NoopClient, err } identifyHash, err := readIdentifyHash(identifyHashFilePath) if err != nil { - return nil, err + return NoopClient, err } return &Client{ @@ -79,15 +86,24 @@ func newCustomClient(config *crcConfig.Config, transport http.RoundTripper, tele } func (c *Client) Close() error { + if c == NoopClient { + return nil + } return c.segmentClient.Close() } func (c *Client) UploadAction(action, source, status string) error { + if c == NoopClient { + return nil + } return c.upload(action, baseProperties(source). Set("status", status)) } func (c *Client) UploadCmd(ctx context.Context, action string, duration time.Duration, err error) error { + if c == NoopClient { + return nil + } return c.upload(action, properties(ctx, err, duration)) } @@ -159,6 +175,9 @@ func writeIdentifyHash(client *Client) error { } func (c *Client) identifyNew() *analytics.Identify { + if c == NoopClient { + return &analytics.Identify{} + } return &analytics.Identify{ UserId: c.userID, Traits: addConfigTraits(c.config, traits()), @@ -166,6 +185,9 @@ func (c *Client) identifyNew() *analytics.Identify { } func (c *Client) upload(action string, a analytics.Properties) error { + if c == NoopClient { + return nil + } if c.config.Get(crcConfig.ConsentTelemetry).AsString() != "yes" { return nil } diff --git a/test/e2e/features/story_openshift.feature b/test/e2e/features/story_openshift.feature index 8d0bab8484..3419f87ac9 100644 --- a/test/e2e/features/story_openshift.feature +++ b/test/e2e/features/story_openshift.feature @@ -41,7 +41,7 @@ Feature: 4 Openshift stories Given executing "oc new-project testproj" succeeds # mirror When executing "oc registry login --insecure=true" succeeds - Then executing "oc image mirror quay.io/centos7/httpd-24-centos7:centos7=default-route-openshift-image-registry.apps-crc.testing/testproj/hello:test --insecure=true --filter-by-os=linux/amd64" succeeds + Then executing "oc image mirror registry.access.redhat.com/ubi8/httpd-24:latest=default-route-openshift-image-registry.apps-crc.testing/testproj/hello:test --insecure=true --filter-by-os=linux/amd64" succeeds And executing "oc set image-lookup hello" succeeds # deploy When executing "oc apply -f hello.yaml" succeeds @@ -56,7 +56,7 @@ Feature: 4 Openshift stories Scenario: Pull image locally, push to registry, deploy Given podman command is available And executing "oc new-project testproj" succeeds - When pulling image "quay.io/centos7/httpd-24-centos7:centos7", logging in, and pushing local image to internal registry succeeds + When pulling image "registry.access.redhat.com/ubi8/httpd-24:latest", logging in, and pushing local image to internal registry succeeds And executing "oc apply -f hello.yaml" succeeds When executing "oc rollout status deployment hello" succeeds Then stdout should contain "successfully rolled out" diff --git a/test/e2e/testsuite/testsuite.go b/test/e2e/testsuite/testsuite.go index 400a8e3e90..75a430d735 100644 --- a/test/e2e/testsuite/testsuite.go +++ b/test/e2e/testsuite/testsuite.go @@ -996,7 +996,7 @@ func PullLoginTagPushImageSucceeds(image string) error { return err } - _, err = cmd.RunPodmanExpectSuccess("push", "default-route-openshift-image-registry.apps-crc.testing/testproj/hello:test", "--tls-verify=false") + _, err = cmd.RunPodmanExpectSuccess("push", "default-route-openshift-image-registry.apps-crc.testing/testproj/hello:test", "--remove-signatures", "--tls-verify=false") if err != nil { return err } diff --git a/test/integration/testsuite_test.go b/test/integration/testsuite_test.go index c95ed59845..0e9ecdba1b 100644 --- a/test/integration/testsuite_test.go +++ b/test/integration/testsuite_test.go @@ -63,6 +63,10 @@ var _ = BeforeSuite(func() { err = util.RemoveCRCConfig() Expect(err).NotTo(HaveOccurred()) + // start shell instance + err = util.StartHostShellInstance("") + Expect(err).NotTo(HaveOccurred()) + // set credPath credPath = filepath.Join(userHome, ".crc", "machines", "crc", "id_rsa")