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

Change references in samples tests to correct versions #1790

Merged
merged 3 commits into from
Sep 12, 2024
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
16 changes: 16 additions & 0 deletions .github/scripts/release-samples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,22 @@ echo "Channel version: ${CHANNEL_VERSION}"
echo "Creating release branch for ${REPOSITORY}..."

pushd $REPOSITORY

git checkout -B "${CHANNEL_VERSION}"

# Update bicepconfig.json br:biceptypes.azurecr.io/radius with the CHANNEL
BICEPCONFIG_RADIUS_STRING_REPLACEMENT="br:biceptypes.azurecr.io/radius:${CHANNEL}"
awk -v REPLACEMENT="${BICEPCONFIG_RADIUS_STRING_REPLACEMENT}" '{gsub(/br:biceptypes\.azurecr\.io\/radius:latest/, REPLACEMENT); print}' bicepconfig.json > bicepconfig_updated.json
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mv bicepconfig_updated.json bicepconfig.json

# Update bicepconfig.json br:biceptypes.azurecr.io/aws with the CHANNEL
BICEPCONFIG_AWS_STRING_REPLACEMENT="br:biceptypes.azurecr.io/aws:${CHANNEL}"
awk -v REPLACEMENT="${BICEPCONFIG_AWS_STRING_REPLACEMENT}" '{gsub(/br:biceptypes\.azurecr\.io\/aws:latest/, REPLACEMENT); print}' bicepconfig.json > bicepconfig_updated.json
mv bicepconfig_updated.json bicepconfig.json

# Push changes to GitHub
git add --all
git commit -m "Update samples for ${VERSION}"
git push origin "${CHANNEL_VERSION}"

popd
61 changes: 49 additions & 12 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ on:
workflow_dispatch:
inputs:
version:
description: "Radius version number to use (e.g. 0.1.0, 0.1.0-rc1, edge). Defaults to edge."
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this default to disambiguate how "defaults" work

description: "Radius version number to use (e.g. 0.1.0, 0.1.0-rc1, edge)."
required: false
default: "edge"
type: string
push:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to run on push

Copy link
Contributor

@sk593 sk593 Sep 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think we should test on pushes. even if the PR runs pass, we've sometimes seen failures on pushes in other repos and runs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I re-added this trigger

willdavsmith marked this conversation as resolved.
Show resolved Hide resolved
branches:
Expand Down Expand Up @@ -93,7 +92,6 @@ jobs:
credential: aws
enableDapr: false
env:
BRANCH: ${{ github.base_ref || github.ref_name }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was unused

GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AZURE_LOCATION: westus3
AWS_REGION: us-west-2
Expand Down Expand Up @@ -123,6 +121,49 @@ jobs:
echo "TEST_EKS_CLUSTER_NAME=eks-${RUN_IDENTIFIER}" >> $GITHUB_OUTPUT
echo "RUN_TEST=${RUN_TEST}" >> $GITHUB_OUTPUT
echo "ENABLE_DAPR=${ENABLE_DAPR}" >> $GITHUB_OUTPUT
- name: Generate Radius version variables
id: gen-radius-version
if: steps.gen-id.outputs.RUN_TEST == 'true'
run: |
RADIUS_VERSION=edge
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
RADIUS_VERSION=${{ github.event.inputs.version }}
elif [[ "${{ github.event_name }}" == "push" ]]; then
# Get the target branch of the push event
TARGET_BRANCH=${{ github.ref }}
if [[ "$TARGET_BRANCH" == "refs/heads/edge" ]]; then
RADIUS_VERSION=edge
elif [[ "$TARGET_BRANCH" =~ ^refs/heads/v[0-9]+\.[0-9]+$ ]]; then
# Example: refs/heads/v0.1 -> 0.1
RADIUS_VERSION=$(echo ${{ github.ref }} | cut -d '/' -f 3 | cut -d 'v' -f 2)
fi
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
# Get the target branch of the pull request
TARGET_BRANCH=${{ github.event.pull_request.base.ref }}
if [[ "$TARGET_BRANCH" == "edge" ]]; then
RADIUS_VERSION=edge
elif [[ "$TARGET_BRANCH" =~ ^refs/pull/v[0-9]+\.[0-9]+/merge$ ]]; then
# Example: refs/pull/v0.1/merge -> 0.1
RADIUS_VERSION=$(echo ${{ github.ref }} | cut -d '/' -f 3 | cut -d 'v' -f 2)
fi
elif [[ "${{ github.event_name }}" == "schedule" ]]; then
# Get the branch of the schedule event
TARGET_BRANCH=${{ github.ref }}
if [[ "$TARGET_BRANCH" == "refs/heads/edge" ]]; then
RADIUS_VERSION=edge
elif [[ "$TARGET_BRANCH" =~ ^refs/heads/v[0-9]+\.[0-9]+$ ]]; then
# Example: refs/heads/v0.1 -> 0.1
RADIUS_VERSION=$(echo ${{ github.ref }} | cut -d '/' -f 3 | cut -d 'v' -f 2)
else
echo "Invalid branch name: $TARGET_BRANCH"
exit 1
fi
else
echo "Invalid event name: ${{ github.event_name }}"
exit 1
fi

echo "RADIUS_VERSION=$RADIUS_VERSION" >> $GITHUB_OUTPUT
- name: Checkout code
if: steps.gen-id.outputs.RUN_TEST == 'true'
uses: actions/checkout@v4
Expand Down Expand Up @@ -213,11 +254,7 @@ jobs:
- name: Download rad CLI
if: steps.gen-id.outputs.RUN_TEST == 'true'
run: |
RADIUS_VERSION="${{ inputs.version }}"
if [[ -z "${{ inputs.version }}" ]]; then
RADIUS_VERSION=edge
fi
./.github/scripts/install-radius.sh $RADIUS_VERSION
./.github/scripts/install-radius.sh ${{ steps.gen-radius-version.outputs.RADIUS_VERSION }}
- name: Initialize default environment
if: steps.gen-id.outputs.RUN_TEST == 'true'
run: |
Expand All @@ -231,10 +268,10 @@ jobs:
rad group switch default
rad env create default
rad env switch default
rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/rediscaches:latest --resource-type Applications.Datastores/redisCaches
rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/mongodatabases:latest --resource-type Applications.Datastores/mongoDatabases
rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/sqldatabases:latest --resource-type Applications.Datastores/sqlDatabases
rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/rabbitmqqueues:latest --resource-type Applications.Messaging/rabbitMQQueues
rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/rediscaches:${{ steps.gen-radius-version.outputs.RADIUS_VERSION }} --resource-type Applications.Datastores/redisCaches
sk593 marked this conversation as resolved.
Show resolved Hide resolved
rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/mongodatabases:${{ steps.gen-radius-version.outputs.RADIUS_VERSION }} --resource-type Applications.Datastores/mongoDatabases
rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/sqldatabases:${{ steps.gen-radius-version.outputs.RADIUS_VERSION }} --resource-type Applications.Datastores/sqlDatabases
rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/rabbitmqqueues:${{ steps.gen-radius-version.outputs.RADIUS_VERSION }} --resource-type Applications.Messaging/rabbitMQQueues
- name: Configure cloud credentials
if: steps.gen-id.outputs.RUN_TEST == 'true' && ( matrix.credential == 'azure' || matrix.credential == 'aws')
run: |
Expand Down