diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index 26e3a7ee..8b83cb20 100644 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -5,7 +5,8 @@ while (! kubectl cluster-info ); do # Docker takes a few seconds to initialize echo "Waiting for Docker to launch..." k3d cluster delete - k3d cluster create -p '8081:80@loadbalancer' --k3s-arg '--disable=traefik@server:0' + # Map localhost port 80 on the external load balancer, and disable traefik and the internal load balancer. + k3d cluster create -p '8081:80@loadbalancer' --k3s-arg '--disable=traefik@server:*' --k3s-arg '--disable=servicelb@server:*' sleep 1 done diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index fb434133..750fd9ad 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -154,7 +154,8 @@ jobs: run: wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash - name: Create k3d cluster if: steps.gen-id.outputs.RUN_TEST == 'true' - run: k3d cluster create --agents 2 -p "80:80@loadbalancer" --k3s-arg "--disable=traefik@server:0" --registry-create sampleregistry:51351 + # Map localhost port 80 on the external load balancer, and disable traefik and the internal load balancer. + run: k3d cluster create --agents 2 -p "80:80@loadbalancer" --k3s-arg "--disable=traefik@server:*" --k3s-arg "--disable=servicelb@server:*" --registry-create sampleregistry:51351 - name: Build images if: steps.gen-id.outputs.RUN_TEST == 'true' && matrix.images != '' run: | @@ -243,7 +244,7 @@ jobs: fi if [[ "${{ matrix.credential }}" == "aws" ]]; then rad env update default --aws-region ${{ env.AWS_REGION }} --aws-account-id ${{ secrets.AWS_ACCOUNT_ID }} - rad credential register aws --access-key-id ${{ secrets.AWS_ACCESS_KEY_ID }} --secret-access-key ${{ secrets.AWS_SECRET_ACCESS_KEY }} + rad credential register aws access-key --access-key-id ${{ secrets.AWS_ACCESS_KEY_ID }} --secret-access-key ${{ secrets.AWS_SECRET_ACCESS_KEY }} fi ## This step is temporary until we have Recipe Packs for Azure & AWS and update the eShop sample - name: Initialize eShop environments diff --git a/.github/workflows/upmerge.yaml b/.github/workflows/upmerge.yaml index 40004588..fd724a92 100644 --- a/.github/workflows/upmerge.yaml +++ b/.github/workflows/upmerge.yaml @@ -1,3 +1,27 @@ +# This workflow automates the process of upmerging changes from the current release branch to the edge branch. +# During the course of a release, the release branch is the default branch so that PRs can be immediately +# brought into the release without waiting for a new release. This workflow merges those changes into +# the edge branch so that edge can be used as the basis for the next release branch. +# +# This workflow assumes that it is being triggered from the current release branch, but it could be triggered from +# any branch, and it uses that branch as the source branch for merging into the edge branch. +# The workflow is triggered manually via the workflow_dispatch event. +# +# The workflow performs the following steps: +# 1. Checks out the edge branch. +# 2. Configures git with a user name and email. +# 3. Creates a new branch from edge. +# 4. Merges changes from the branch executing the workflow into the edge branch created in the previous step. +# 5. Pushes the new branch if there are changes. +# 6. Creates a pull request to merge the new branch into edge. + +# Example: +# The current release branch is v0.36. We are creating the new release for v0.37. +# The release person manually triggers this workflow from branch v0.36. The workflow runs, which does the following +# 1. A new branch is created named upmerge/2024-07-31-98b9. The source branch is edge. +# 2. Changes from branch v0.36 are merged into branch upmerge/2024-07-31-98b9. +# 3. A PR is created from branch upmerge/2024-07-31-98b9 --> edge. The workflow finishes and reports success. + name: Upmerge samples to edge on: @@ -8,30 +32,49 @@ jobs: name: Upmerge samples to edge runs-on: ubuntu-latest steps: + + # Check out the edge branch - uses: actions/checkout@v4 with: ref: edge # https://github.com/actions/checkout/issues/125#issuecomment-570254411 fetch-depth: 0 + - name: Configure git run: | git config --global user.email "radiuscoreteam@service.microsoft.com" git config --global user.name "Radius CI Bot" - - name: Create new branch + + # Create a new branch from edge. This branch will be used to PR back into edge. + - name: Create new branch from edge run: | export DATE=$(date +%Y-%m-%d) export RAND=$(openssl rand -hex 2) - echo "BRANCH_NAME=upmerge/$DATE-$RAND" >> $GITHUB_ENV - git checkout -b upmerge/$DATE-$RAND + export BRANCH_NAME=upmerge/$DATE-$RAND + echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV + git checkout -b $BRANCH_NAME + + # Merge changes from the github.ref branch, i.e., the branch from which the workflow is triggered. That + # branch is assumed to be the current release branch, but could be any branch. + # If there are no changes, stop the workflow. - name: Upmerge samples run: | export SOURCE_BRANCH=$(basename ${{ github.ref }}) echo "Upmerging samples from $SOURCE_BRANCH to edge" git fetch origin $SOURCE_BRANCH - git merge --no-commit origin/$SOURCE_BRANCH - git commit -m "Upmerge to edge" - git push --set-upstream origin $BRANCH_NAME + git merge -m "Upmerge to edge" origin/$SOURCE_BRANCH + + if git diff --quiet edge; then + echo "No changes to merge from $SOURCE_BRANCH to edge" + echo "NO_CHANGES=true" >> $GITHUB_ENV + else + echo "Pushing $BRANCH_NAME for PR to edge" + git push --set-upstream origin $BRANCH_NAME + fi + + # Create a PR from the new branch to edge - name: Create pull request + if: env.NO_CHANGES != 'true' env: GITHUB_TOKEN: ${{ secrets.GH_RAD_CI_BOT_PAT}} run: gh pr create --title "Upmerge to edge" --body "Upmerge to edge (kicked off by @${{ github.triggering_actor }})" --base edge --head $BRANCH_NAME diff --git a/samples/eshop/README.md b/samples/eshop/README.md index efadf083..10a8c12a 100644 --- a/samples/eshop/README.md +++ b/samples/eshop/README.md @@ -16,7 +16,7 @@ This reference app is a "radified" version of the [eShop on containers](https:// 1. Set provider credentials to authenticate to your cloud provider (choose which type of hosting infrastructure you wish to use): ```bash # AWS - rad credential register aws --aws-access-key-id --aws-secret-access-key + rad credential register aws access-key --aws-access-key-id --aws-secret-access-key # Azure rad credential register azure sp --client-id --client-secret --tenant-id