Add test that unauthorized pushes are blocked
Some checks are pending
Some checks are pending
This commit is contained in:
parent
618ce2d679
commit
70407d7f35
1 changed files with 10 additions and 1 deletions
|
@ -756,13 +756,22 @@ docker pull YOUR_CI_CD_IP/APP_NAME/test:latest
|
|||
# Verify the image was pulled successfully
|
||||
docker images | grep APP_NAME/test
|
||||
|
||||
# Clean up test image
|
||||
# Test that unauthorized push is blocked
|
||||
echo "FROM alpine:latest" > /tmp/unauthorized.Dockerfile
|
||||
echo "RUN echo 'This push should fail'" >> /tmp/unauthorized.Dockerfile
|
||||
docker build -f /tmp/unauthorized.Dockerfile -t YOUR_CI_CD_IP/APP_NAME/unauthorized:latest /tmp
|
||||
docker push YOUR_CI_CD_IP/APP_NAME/unauthorized:latest
|
||||
# Expected: This should fail with authentication error
|
||||
|
||||
# Clean up test images
|
||||
docker rmi YOUR_CI_CD_IP/APP_NAME/test:latest
|
||||
docker rmi YOUR_CI_CD_IP/APP_NAME/unauthorized:latest
|
||||
```
|
||||
|
||||
**Expected behavior**:
|
||||
- ✅ **Push requires authentication**: `docker push` only works when logged in
|
||||
- ✅ **Pull works without authentication**: `docker pull` works without login for public projects
|
||||
- ✅ **Unauthorized push is blocked**: `docker push` fails when not logged in
|
||||
- ✅ **Web UI accessible**: Harbor UI is available at `https://YOUR_CI_CD_IP`
|
||||
|
||||
#### 5.12 Harbor Access Model Summary
|
||||
|
|
Loading…
Add table
Reference in a new issue