Skip to content

Update Timestamp (#1232) #1408

Update Timestamp (#1232)

Update Timestamp (#1232) #1408

#
# 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@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
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@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
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
- name: Configure cargo cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
with:
path: |
/tmp/tuftool-target
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-tuftool
- name: Install tuftool
run: |
# use the latest version
cargo install tuftool \
--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>=4.0.0"
python3 tests/client-tests/python-tuf.py
jsclient:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Setup node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20
- 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