Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gh action download #28

Merged
merged 10 commits into from
May 2, 2024
4 changes: 2 additions & 2 deletions .github/workflows/windows-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
186 changes: 13 additions & 173 deletions .github/workflows/windows-qe-tpl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion cmd/crc/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion images/build-e2e/Containerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion images/build-integration/Containerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
8 changes: 4 additions & 4 deletions images/build-integration/lib/darwin/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..
Expand Down
8 changes: 4 additions & 4 deletions images/build-integration/lib/linux/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..
Expand Down
2 changes: 1 addition & 1 deletion packaging/chocolatey/crc/crc.nuspec.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<owners>anjannath</owners>
<title>CRC - Runs Containers</title>
<authors>https://github.com/crc-org</authors>
<projectUrl>https://crc.dev/blog/about</projectUrl>
<projectUrl>https://crc.dev/blog</projectUrl>
<bugTrackerUrl>https://github.com/crc-org/crc/issues</bugTrackerUrl>
<iconUrl>https://cdn.statically.io/gh/crc-org/blog/main/static/crc-upstream-logo.png</iconUrl>
<licenseUrl>https://github.com/crc-org/crc/blob/main/LICENSE</licenseUrl>
Expand Down
Loading