Git Product home page Git Product logo

iso-10303-stepmod-migration's Introduction

ISO 10303 STEPmod CVS import to Git

Warning
This repository has been archived as its purpose is complete. The successor to this repository is iso-10302-stepmod-annotate, where the Annotated EXPRESS conversion flow uses the ISO BitBucket Git repository as data source.

import-archive import-wg12 annotate

Purpose

This repository contains a workflow that imports the ISO 10303 STEPmod CVS repository at Boost to the iso-10303-stepmod-cvs Git repository.

Details

There are two repos involved here:

Under .github/ you will see the import.yml workflow.

The workflow depends on these two tools:

The workflow goes:

  1. Use rsync to retrieve the CVS repository hosted at Boost via ssh;

  2. Run reposurgeon with the provided configuration to convert the whole repository history into Git;

  3. Push all Git tags and branches to the "converted" GitHub repo, using the metanorma-ci GitHub user.

Note
The Boost Conseil CVS is located at cvs.boost-lab.net.
Note
Previous (and deprecated) attempts to do the same are documented at previous-attempts.adoc.

Frequency

This workflow is run once a day to import latest changes from Boost CVS.

Usage

Import strategy

Cloning a remote CVS repository while importing is super slow, especially for a large repository like STEPmod.

We have tested and settled on these steps:

  1. Maintain a local rsync copy of the CVS repository.

  2. Resolve all names from the CVS repository (CVS only stores UNIX usernames, in Git are names and emails) with a reposurgeon user map.

  3. Run reposurgeon which depends on cvs-fast-import to import the CVS repository into the iso-10303-stepmod-cvs Git repo.

Creating the rsync clone of the CVS repository

rsync -avrPz -e ssh {{username}}@{{cvshost}}:/stepmod/ stepmod-rsync/

Install reposurgeon

The best repository conversion tool, ever. reposurgeon works on Linux and macOS.

On Ubuntu the version is outdated and does not contain the functionality we need here, so we must build it from scratch from Git.

Ubuntu:

git clone https://gitlab.com/esr/reposurgeon
cd reposurgeon
git checkout 2f5f83ec63da34beaf8293434b5e1627366dfa7c
sed -i 's/apt-get install /apt-get install -y /' Makefile
make fullinstall
make all

The Homebrew macOS version is recent enough to work with our workflow.

macOS:

brew install reposurgeon

Install cvs-fast-export

reposurgeon depends on the cvs-fast-export tool which works on Linux and macOS.

Ubuntu:

$ apt-get -y install cvs-fast-export

macOS:

$ brew install cvs-fast-export

(one time) Setting up the reposurgeon conversion flow

This is a first-time only step that is only needed only when you first setup reposurgeon migration for a repository.

$ cd stepmod
$ repotool initialize stepmod
repotool: what VCS do you want to convert from? cvs
repotool: what VCS do you want to convert to? git
repotool: generating Makefile, some variables in it need to be set.
repotool: generating a stub options file.
repotool: generating a stub lift file.
repotool: generating a stub map file.

Then you need to fill in:

  • Makefile at READ_OPTIONS = to determine what to convert into Git branches

  • stepmod.lift if you want to add additional reposurgeon commands

The way to determine what commands to provide reposurgeon is via testing in the reposurgeon CLI:

$ reposurgeon
reposurgeon%

Please refer to the reposurgeon manual for details.

Getting all users for email mapping

Find all authors in the CVS repository using make stubmap.

$ cd stepmod
$ make stubmap

Then manually edit the stepmod.map file to provide author information.

Run reposurgeon to convert

After all authors are mapped, run reposurgeon to create stepmod-git.

$ # assume that stepmod-rsync is the rsync copy
$ cd stepmod
$ # link the rsync'ed copy's /stepmod directory to stepmod-mirror
$ ln -s ../stepmod-rsync/stepmod stepmod-mirror
$ # run reposurgeon to perform conversion
$ make

The converted Git repo will be available at stepmod/stepmod-git.

Upload the converted Git repo

We actually use more complicated steps to upload commits via GHA iteratively in batches of commits (see import.yaml), but locally the following works.

$ cd stepmod/stepmod-git
$ git remote add origin [email protected]/metanorma/iso-10303-stepmod-cvs
$ git push --all
$ git push --tags

iso-10303-stepmod-migration's People

Contributors

ronaldtse avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iso-10303-stepmod-migration's Issues

Implement automated CVS import and conversion to Git

We need to implement an automatic CVS import, migrate to Git and push to metanorma/iso-10303-stepmod-cvs.

There are two repos involved here:

This current repository is used to store the import workflow. Under .github/ you will see this workflow:

  1. The whole workflow depends on the “cvs-fast-export” package
  2. It uses cvssync to retrieve the repo via ssh
  3. It runs cvs-fast-export to create a git fast import file
  4. We import it into a new git repo
  5. We add an extra file to git repo (not working yet)
  6. We should push to a GitHub repo (to be done using the push token is METANORMA_CI_PAT_TOKEN)

We need to use a private SSH key to make the initial CVS export.

  • hostname: [email protected]
  • key secret variable: secrets.BOOST_CVS_SSH_PRIVATE_KEY
  • known hosts: secrets.BOOST_CONSEIL_KNOWN_HOSTS

Command to sync:

cvssync -v [email protected]:/stepmod stepmod/data

Note that we're only cloning out stepmod/data since the rest of the data is unnecessary for our purpose (and too large for GitHub). We do need /repository_index.xml but we'll deal with it individually.

Creating the Git fast import file:

find stepmod/data | cvs-fast-export -t 4 -p -A author-map.txt > stepmod.fi

Create the new git repository:

git init iso-10303-stepmod-cvs
git -C iso-10303-stepmod-cvs remote add origin \
  https://metanorma-ci:${{ secrets.METANORMA_CI_PAT_TOKEN }}@github.com/metanorma/iso-10303-stepmod-cvs

Import the fast-import file:

git -C iso-10303-stepmod-cvs fast-import < ../stepmod.fi

The other file we need that is not under data/ is repository_index.xml, we're going to add it manually.

cd /tmp
cvs co stepmod/repository_index.xml
cd $GITHUB_WORKSPACE/iso-10303-stepmod-cvs
mv /tmp/stepmod/repository_index.xml .
git add repository_index.xml
git commit -m 'Add repository_index.xml'

At the end do a Git push.

@CAMOBAP has done a similar workflow here for Interscript:
https://github.com/interscript/interscript/blob/master/.github/workflows/release.yml

Switch to use reposurgeon

While reposurgeon uses cvs-fast-export, reposurgeon has great functionality that ensure commits are not lost and that all loose commits are capped with Git branches.

This task is to switch to it.

Migration failure on large file in CVS

I started seeing this failure a few days ago from the CVS import task:

remote: error: File business_object_models/managed_model_based_3d_engineering_domain/managed_model_based_3d_engineering_domain.tar is 118.34 MB; this exceeds GitHub's file size limit of 100.00 MB        

(from https://github.com/metanorma/iso-10303-stepmod-migration/runs/2572029179?check_suite_focus=true)

Someone uploaded this particular file (managed_model_based_3d_engineering_domain.tar) which is just a “tar” (uncompressed) instead of a tar.gz.

Questions:

  1. Is this file expected to remain? Or is it a temporary thing? Or could it be removed?
  2. If permanent, can it be compressed to a tar.gz?

Have pinged @TRThurman @brandonsapp

ISO BitBucket doesn't allow force pushes for import step

Due to #2 we have to perform force-pushes for the import step, but seems that ISO BitBucket doesn't support that.

See https://github.com/metanorma/iso-10303-stepmod-migration/runs/3158088278?check_suite_focus=true for the actual failure.

2021-07-26T05:20:55.4078391Z remote: error: cannot lock ref 'refs/heads/CR_Geometry_2': is at 38e5a94cff29f7e6f80125accbcd2c54a245dba0 but expected 495905e730dd0912c7602f68f33460fef895807f        
2021-07-26T05:20:55.4082914Z remote: error: cannot lock ref 'refs/heads/CR_Harmo': is at 6f83db18714255bbdb6c78c61d33b0331bd2c2c2 but expected b1453f872b43124456f7ffcc277c70db01e40c9a        
2021-07-26T05:20:55.4086420Z remote: error: cannot lock ref 'refs/heads/CR_PMI_4': is at 6429d030d99bd7861d1903eb2d11f8a90fd8917d but expected 1ee84bd6df808664594aa0c7b02599ff0eab4ecc        
2021-07-26T05:20:55.4089624Z remote: error: cannot lock ref 'refs/heads/CR_PMI_5': is at 86e2202a943570b973d1e91851ac9f56a2b4c7be but expected 1e6fd2cbc82f7503cbf99114b2a83385c1fbeb3f        
2021-07-26T05:20:55.4092789Z remote: error: cannot lock ref 'refs/heads/CR_SMRLv9': is at 00fbde2e90ef8b67e95a8aa28c5186fcd046c111 but expected 23fe1d3bdd4ed7d9b9769065ca7e17a4a8546982        
2021-07-26T05:20:55.4095956Z remote: error: cannot lock ref 'refs/heads/CR_part42': is at a64b0e99ada4e18b61730b83e81202866a369e3d but expected cc7484673e2aeb3bcce3697736e90fa31d25cdcf        
2021-07-26T05:20:55.4098361Z remote: error: cannot lock ref 'refs/heads/CR_ILS': reference already exists        
2021-07-26T05:20:55.4100221Z remote: error: cannot lock ref 'refs/heads/main': reference already exists        
2021-07-26T05:20:55.4117319Z To https://sd.iso.org/bitbucket-pilot/scm/~ronald.tse_eccma.org/smrl-metanorma.git
2021-07-26T05:20:55.4119294Z  ! [remote rejected]       CR_Geometry_2 -> CR_Geometry_2 (failed to update ref)
2021-07-26T05:20:55.4120858Z  ! [remote rejected]       CR_Harmo -> CR_Harmo (failed to update ref)
2021-07-26T05:20:55.4122318Z  ! [remote rejected]       CR_PMI_4 -> CR_PMI_4 (failed to update ref)
2021-07-26T05:20:55.4123780Z  ! [remote rejected]       CR_PMI_5 -> CR_PMI_5 (failed to update ref)
2021-07-26T05:20:55.4125247Z  ! [remote rejected]       CR_SMRLv9 -> CR_SMRLv9 (failed to update ref)
2021-07-26T05:20:55.4126736Z  ! [remote rejected]       CR_part42 -> CR_part42 (failed to update ref)
2021-07-26T05:20:55.4128771Z  ! [remote rejected]       CR_ILS -> CR_ILS (failed to update ref)
2021-07-26T05:20:55.4130035Z  ! [remote rejected]       main -> main (failed to update ref)
2021-07-26T05:20:55.4583886Z error: failed to push some refs to 'https://sd.iso.org/bitbucket-pilot/scm/~ronald.tse_eccma.org/smrl-metanorma.git'
2021-07-26T05:20:55.4601330Z ##[error]Process completed with exit code 1.

Prepare for CVS cut off

As per TF 1 write access to CVS has been cut off and moving forward we will utilize the WG 12 copy for editing.

We need to move the annotation workflow to work on the WG 12 copy instead of the CVS copy.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.