Skip to content

Commit

Permalink
test: add mariner container test
Browse files Browse the repository at this point in the history
Signed-off-by: Junjie Gao <[email protected]>
  • Loading branch information
JeyJeyGao committed Jan 9, 2024
1 parent 94ca6f5 commit c2c2b00
Showing 1 changed file with 117 additions and 78 deletions.
195 changes: 117 additions & 78 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,48 @@ jobs:
name: win-amd64-binary
path: ./bin/artifacts/notation-azure-kv_0.0.1_windows_amd64.zip
retention-days: 1
e2e-linux:
# e2e-linux:
# name: E2E testing on Linux
# runs-on: ubuntu-latest
# needs: test
# if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push'
# steps:
# - name: Check out code into the project directory
# uses: actions/checkout@v3
# - uses: actions/download-artifact@v3
# with:
# name: linux-amd64-binary
# path: ./bin/artifacts
# - name: Run download server locally
# run: |
# nohup python3 -m http.server --directory ./bin/artifacts/ &

# # prepare the environment variables for E2E
# artifactName=notation-azure-kv_0.0.1_linux_amd64.tar.gz
# checksum=$(shasum -a 256 "./bin/artifacts/$artifactName" | awk '{print $1}')
# echo "pluginChecksum=$checksum" >> "$GITHUB_ENV"
# echo "pluginDownloadURL=http://localhost:8000/$artifactName" >> "$GITHUB_ENV"
# - name: Prepare container registry
# run: |
# docker run --name registry --rm -d -p 5000:5000 registry:2
# docker pull hello-world:latest
# docker tag hello-world:latest localhost:5000/hello-world:v1
# docker push localhost:5000/hello-world:v1
# - name: Azure login
# uses: azure/login@v1
# with:
# creds: ${{ secrets.AZURE_CREDENTIALS }}
# - name: E2E testing
# uses: ./test/e2e
# with:
# pluginDownloadURL: ${{ env.pluginDownloadURL }}
# pluginChecksum: ${{ env.pluginChecksum }}
e2e-linux-mariner-container:
name: E2E testing on Linux
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/cbl-mariner/distroless/minimal:2.0
options: --cpus 1
needs: test
if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push'
steps:
Expand Down Expand Up @@ -113,83 +152,83 @@ jobs:
with:
pluginDownloadURL: ${{ env.pluginDownloadURL }}
pluginChecksum: ${{ env.pluginChecksum }}
e2e-windows:
name: E2E testing on Windows
runs-on: windows-2022
needs: test
if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push'
steps:
- name: Check out code into the project directory
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: win-amd64-binary
path: ./bin/artifacts
- name: Run download server locally
run: |
# wsl bash
bash -c 'nohup python3 -m http.server --directory ./bin/artifacts/ &'
# e2e-windows:
# name: E2E testing on Windows
# runs-on: windows-2022
# needs: test
# if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push'
# steps:
# - name: Check out code into the project directory
# uses: actions/checkout@v3
# - uses: actions/download-artifact@v3
# with:
# name: win-amd64-binary
# path: ./bin/artifacts
# - name: Run download server locally
# run: |
# # wsl bash
# bash -c 'nohup python3 -m http.server --directory ./bin/artifacts/ &'

# Prepare the environment variables for E2E
$artifactName = "notation-azure-kv_0.0.1_windows_amd64.zip"
$checksum = (Get-FileHash ".\bin\artifacts\$artifactName" -Algorithm SHA256).Hash
"pluginChecksum=$checksum" | Out-File -Append -FilePath $Env:GITHUB_ENV
"pluginDownloadURL=http://localhost:8000/$artifactName" | Out-File -Append -FilePath $Env:GITHUB_ENV
shell: pwsh
- name: Prepare container registry
run: |
docker run --name registry --rm -d -p 5000:5000 junjiegaomsft/registry:v2.8.2-ltsc2022
docker pull hello-world:latest
docker tag hello-world:latest localhost:5000/hello-world:v1
docker push localhost:5000/hello-world:v1
shell: pwsh
- name: Azure login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: E2E testing
uses: ./test/e2e
with:
pluginDownloadURL: ${{ env.pluginDownloadURL }}
pluginChecksum: ${{ env.pluginChecksum }}
e2e-macos:
name: E2E testing on macOS
runs-on: macos-13
needs: test
if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push'
steps:
- name: Check out code into the project directory
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: darwin-amd64-binary
path: ./bin/artifacts
- name: Run download server locally
run: |
nohup python3 -m http.server --directory ./bin/artifacts/ &
# # Prepare the environment variables for E2E
# $artifactName = "notation-azure-kv_0.0.1_windows_amd64.zip"
# $checksum = (Get-FileHash ".\bin\artifacts\$artifactName" -Algorithm SHA256).Hash
# "pluginChecksum=$checksum" | Out-File -Append -FilePath $Env:GITHUB_ENV
# "pluginDownloadURL=http://localhost:8000/$artifactName" | Out-File -Append -FilePath $Env:GITHUB_ENV
# shell: pwsh
# - name: Prepare container registry
# run: |
# docker run --name registry --rm -d -p 5000:5000 junjiegaomsft/registry:v2.8.2-ltsc2022
# docker pull hello-world:latest
# docker tag hello-world:latest localhost:5000/hello-world:v1
# docker push localhost:5000/hello-world:v1
# shell: pwsh
# - name: Azure login
# uses: azure/login@v1
# with:
# creds: ${{ secrets.AZURE_CREDENTIALS }}
# - name: E2E testing
# uses: ./test/e2e
# with:
# pluginDownloadURL: ${{ env.pluginDownloadURL }}
# pluginChecksum: ${{ env.pluginChecksum }}
# e2e-macos:
# name: E2E testing on macOS
# runs-on: macos-13
# needs: test
# if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push'
# steps:
# - name: Check out code into the project directory
# uses: actions/checkout@v3
# - uses: actions/download-artifact@v3
# with:
# name: darwin-amd64-binary
# path: ./bin/artifacts
# - name: Run download server locally
# run: |
# nohup python3 -m http.server --directory ./bin/artifacts/ &

# prepare the environment variables for E2E
artifactName=notation-azure-kv_0.0.1_darwin_amd64.tar.gz
checksum=$(shasum -a 256 "./bin/artifacts/$artifactName" | awk '{print $1}')
echo "pluginChecksum=$checksum" >> "$GITHUB_ENV"
echo "pluginDownloadURL=http://localhost:8000/$artifactName" >> "$GITHUB_ENV"
- name: Prepare container registry
run: |
# start zot registry
wget -O zot https://github.com/project-zot/zot/releases/download/v2.0.0-rc7/zot-darwin-amd64-minimal
chmod +x zot
nohup ./zot serve ./test/e2e/zot/config.json &
# # prepare the environment variables for E2E
# artifactName=notation-azure-kv_0.0.1_darwin_amd64.tar.gz
# checksum=$(shasum -a 256 "./bin/artifacts/$artifactName" | awk '{print $1}')
# echo "pluginChecksum=$checksum" >> "$GITHUB_ENV"
# echo "pluginDownloadURL=http://localhost:8000/$artifactName" >> "$GITHUB_ENV"
# - name: Prepare container registry
# run: |
# # start zot registry
# wget -O zot https://github.com/project-zot/zot/releases/download/v2.0.0-rc7/zot-darwin-amd64-minimal
# chmod +x zot
# nohup ./zot serve ./test/e2e/zot/config.json &

# install oras
wget -O oras.tar.gz https://github.com/oras-project/oras/releases/download/v1.1.0/oras_1.1.0_darwin_amd64.tar.gz
tar -zxf oras.tar.gz
./oras push localhost:5000/hello-world:v1 --artifact-type application/octet-stream ./LICENSE
- name: Azure login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: E2E testing
uses: ./test/e2e
with:
pluginDownloadURL: ${{ env.pluginDownloadURL }}
pluginChecksum: ${{ env.pluginChecksum }}
# # install oras
# wget -O oras.tar.gz https://github.com/oras-project/oras/releases/download/v1.1.0/oras_1.1.0_darwin_amd64.tar.gz
# tar -zxf oras.tar.gz
# ./oras push localhost:5000/hello-world:v1 --artifact-type application/octet-stream ./LICENSE
# - name: Azure login
# uses: azure/login@v1
# with:
# creds: ${{ secrets.AZURE_CREDENTIALS }}
# - name: E2E testing
# uses: ./test/e2e
# with:
# pluginDownloadURL: ${{ env.pluginDownloadURL }}
# pluginChecksum: ${{ env.pluginChecksum }}

0 comments on commit c2c2b00

Please sign in to comment.