diff --git a/.github/scripts/publish-recipes.sh b/.github/scripts/publish-recipes.sh index 74e6b72345d..c839334b0d3 100755 --- a/.github/scripts/publish-recipes.sh +++ b/.github/scripts/publish-recipes.sh @@ -6,7 +6,7 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software @@ -50,12 +50,11 @@ if [[ -z "$GITHUB_STEP_SUMMARY" ]]; then GITHUB_STEP_SUMMARY=/dev/null fi -echo "## Recipes published to $REGISTRY_PATH" >> $GITHUB_STEP_SUMMARY -for RECIPE in $(find "$DIRECTORY" -type f -name "*.bicep") -do +echo "## Recipes published to $REGISTRY_PATH" >>$GITHUB_STEP_SUMMARY +for RECIPE in $(find "$DIRECTORY" -type f -name "*.bicep"); do FILENAME=$(basename $RECIPE) PUBLISH_REF="$REGISTRY_PATH/${FILENAME%.*}:$RECIPE_VERSION" - + # Skip files that start with _. These are not recipes, they are modules that are # used by the recipes. if [[ $(basename $RECIPE) =~ ^_.* ]]; then @@ -64,6 +63,14 @@ do fi echo "Publishing $RECIPE to $PUBLISH_REF" - echo "- $PUBLISH_REF" >> $GITHUB_STEP_SUMMARY - rad bicep publish --file $RECIPE --target "br:$PUBLISH_REF" + echo "- $PUBLISH_REF" >>$GITHUB_STEP_SUMMARY + + # Check if INSECURE_REGISTRY is set. If it is, we'll use the --plain-http flag when + # publishing the recipe. + if [[ -n "$INSECURE_REGISTRY" ]]; then + echo "INSECURE_REGISTRY is set. Using --plain-http flag." + rad bicep publish --file $RECIPE --target "br:$PUBLISH_REF" --plain-http + else + rad bicep publish --file $RECIPE --target "br:$PUBLISH_REF" + fi done diff --git a/.github/workflows/functional-test-noncloud.yaml b/.github/workflows/functional-test-noncloud.yaml index 881961cd7ae..27c355263b0 100644 --- a/.github/workflows/functional-test-noncloud.yaml +++ b/.github/workflows/functional-test-noncloud.yaml @@ -21,6 +21,7 @@ permissions: contents: read # Required for listing the commits packages: write # Required for uploading the package checks: write # Required for creating a check run + issues: write # Required for posting comments on issues on: # Enable manual trigger @@ -58,12 +59,18 @@ env: DAPR_DASHBOARD_VER: "0.14.0" # Kubectl version KUBECTL_VER: "v1.25.0" + # Container registry for storing container images - CONTAINER_REGISTRY: ghcr.io/${{ github.repository_owner }}/dev + CONTAINER_REGISTRY: "radius-registry:5000" # Container registry for storing Bicep recipe artifacts - BICEP_RECIPE_REGISTRY: ghcr.io/${{ github.repository_owner }}/dev + BICEP_RECIPE_REGISTRY: "radius-registry:5000" + # Local Docker registry name + LOCAL_REGISTRY_NAME: "radius-registry" + # Local Docker registry port + LOCAL_REGISTRY_PORT: "5000" + # The radius functional test timeout - FUNCTIONALTEST_TIMEOUT: 30m + FUNCTIONALTEST_TIMEOUT: 15m # The base directory for storing test logs RADIUS_CONTAINER_LOG_BASE: dist/container_logs # The Radius helm chart location. @@ -74,6 +81,7 @@ env: TF_RECIPE_MODULE_SERVER_URL: "http://tf-module-server.radius-test-tf-module-server.svc.cluster.local" # Private Git repository where terraform module for testing is stored. TF_RECIPE_PRIVATE_GIT_SOURCE: "git::https://github.com/radius-project/terraform-private-modules//kubernetes-redis" + # The number of failed tests to report. ISSUE_CREATE_THRESHOLD: 2 @@ -133,7 +141,7 @@ jobs: name: Run ${{ matrix.name }} functional tests needs: build strategy: - fail-fast: true + fail-fast: false matrix: os: [ubuntu-latest] name: @@ -201,12 +209,29 @@ jobs: restore-keys: | ${{ runner.os }}-go- - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Create local Docker registry + run: | + # This is going to start an insecure registry on localhost:5000 on the host machine. + if [ "$(docker inspect -f '{{.State.Running}}' "${{ env.LOCAL_REGISTRY_NAME }}" 2>/dev/null || true)" != 'true' ]; then + docker run \ + -d --restart=always -p "127.0.0.1:${{ env.LOCAL_REGISTRY_PORT }}:5000" --network bridge --name "${{ env.LOCAL_REGISTRY_NAME }}" \ + registry:2 + fi + + - name: Add insecure registry to Docker daemon + run: | + # Check if /etc/docker/daemon.json exists + if [ ! -f /etc/docker/daemon.json ]; then + echo "daemon.json doesn't exist. Creating one..." + echo '{}' | sudo tee /etc/docker/daemon.json + fi + + echo '{"insecure-registries": ["localhost:5000"]}' | sudo tee /etc/docker/daemon.json + sudo systemctl restart docker + + - name: Add radius-registry to /etc/hosts + run: | + sudo sh -c 'echo "127.0.0.1 radius-registry" >> /etc/hosts' - name: Build and Push container images run: | @@ -234,11 +259,78 @@ jobs: curl -sSLo "kind" "https://github.com/kubernetes-sigs/kind/releases/download/${{ env.KIND_VER }}/kind-linux-amd64" chmod +x ./kind + # Create kind cluster with containerd registry config dir enabled cat <