Skip to content

Trigger preproduction sync only after merge to main #1316

Trigger preproduction sync only after merge to main

Trigger preproduction sync only after merge to main #1316

#
# Copyright 2022 The Sigstore Authors.
#
# 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
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: TUF Client tests
on:
workflow_dispatch:
push:
paths:
- 'repository/**'
pull_request:
jobs:
client:
runs-on: ubuntu-latest
steps:
# Set up a repository server with python
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
fetch-depth: 2
- run: |
cd repository/repository/
python -m http.server 8001 &
echo "REPO=http://localhost:8001" >> $GITHUB_ENV
# Test with go-tuf client
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: './go.mod'
check-latest: true
- run: |
go install github.com/theupdateframework/go-tuf/cmd/tuf-client@v0.7.0
- run: |
# Only 5.root.json is compatible with new versions of go-tuf
if [ -f repository/repository/5.root.json ]; then
tuf-client init http://localhost:8001 repository/repository/5.root.json
tuf-client list http://localhost:8001
fi
# Verify with a go-tuf client that can understand deprecated keys
go run ./tests/client-tests init http://localhost:8001 repository/repository/1.root.json
go run ./tests/client-tests list http://localhost:8001
# Test with rust client
# Re-enable this job once Tough supports updated ecdsa keytypes
# https://github.com/awslabs/tough/issues/754
# - name: Configure cargo cache
# uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319
# with:
# path: |
# /tmp/tuftool-target
# ~/.cargo/registry/index/
# ~/.cargo/registry/cache/
# ~/.cargo/git/db/
# key: ${{ runner.os }}-cargo-tuftool
# - name: Install tuftool
# run: |
# cargo install tuftool \
# --version "0.10.2" --target-dir /tmp/tuftool-target
# - run: |
# tuftool download out \
# --root repository/repository/2.root.json \
# -t http://localhost:8001/targets \
# -m http://localhost:8001
# Test with python-tuf ngclient
- run: |
python3 -m pip install securesystemslib[crypto,pynacl] tuf
python3 tests/client-tests/python-tuf.py
jsclient:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- name: Setup node
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3
with:
node-version: 16
- name: Install tufjs/cli
run: npm install -g @tufjs/cli
- run: |
cd repository/repository/
python -m http.server 8001 &
- name: Download and verify root
run: |
tuf download \
--metadata-base-url http://localhost:8001 \
--root repository/repository/5.root.json \
--target-name trusted_root.json