Skip to content

Merge pull request #617 from containerish/dependabot-go_modules-golan… #820

Merge pull request #617 from containerish/dependabot-go_modules-golan…

Merge pull request #617 from containerish/dependabot-go_modules-golan… #820

name: OCI Distribution Spec - Pull Image
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
concurrency:
group: pull-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
PGUSER: postgres
POSTGRES_DB: open_registry
POSTGRES_PASSWORD: Qwerty@123
POSTGRES_USER: postgres
jobs:
conformance:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
PGUSER: postgres
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: Qwerty@123
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- name: Build and configure OpenRegistry container image
run: |
IP=`hostname -I | awk '{print $1}'`
echo "IP=$IP" >> $GITHUB_ENV
echo "OCI_ROOT_URL=http://$IP:5000" >> $GITHUB_ENV
cp config.example.yaml config.yaml
IP=$IP yq e -i '.database.host = env(IP)' config.yaml
yq e -i '.dfs.mock.enabled = "true"' config.yaml
yq e -i '.dfs.mock.type = "FS"' config.yaml
go mod download
go build
make certs
./OpenRegistry migrations init \
--admin-db="postgres" \
--admin-db-username="postgres" \
--admin-db-password=${POSTGRES_PASSWORD} \
--database=${POSTGRES_DB} \
--host=${IP} \
--password=${POSTGRES_PASSWORD} \
--insecure=true
nohup ./OpenRegistry start >> openregistry.log &
sleep 3
curl -XPOST -d '{"email": "johndoe@example.com", "username": "johndoe", "password": "Qwerty@123"}' "http://${IP}:5000/auth/signup"
cat openregistry.log
- name: Run OCI Distribution Spec conformance tests
if: always()
run: |
git clone https://github.com/opencontainers/distribution-spec.git
pushd distribution-spec/conformance
git checkout v1.1.0-rc.3
go test -c
./conformance.test
popd
mkdir -p .out/ && mv {distribution-spec/conformance/report.html,distribution-spec/conformance/junit.xml} .out/
env:
OCI_ROOT_URL: ${{ env.OCI_ROOT_URL }}
OCI_USERNAME: ${{ secrets.OPENREGISTRY_USERNAME }}
OCI_PASSWORD: ${{ secrets.OPENREGISTRY_PASSWORD }}
OCI_NAMESPACE: ${{ secrets.OPENREGISTRY_USERNAME }}/distribution-test
OCI_TEST_PUSH: 1
OCI_HIDE_SKIPPED_WORKFLOWS: 1
OCI_CROSSMOUNT_NAMESPACE: ${{secrets.OPENREGISTRY_USERNAME}}/distribution-cross-mount
OCI_DEBUG: 0
- name: Setup tmate session if mode is debug and OpenRegistry or OCI Tests Fail
uses: mxschmitt/action-tmate@v3
if: ${{ always() && (github.event_name == 'workflow_dispatch') && inputs.debug_enabled }}
- name: Set output report name
id: vars
run: echo "short_commit_hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Upload test results zip as build artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: oci-distribution-pull-report-${{ steps.vars.outputs.short_commit_hash }}
path: |
.out/report.html
.out/junit.xml
env:
GITHUB_SHORT_SHA: $(echo ${ github.sha } | cut -c1-8)