Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<package name="test-GitPkgB" project="test:factory">
<title/>
<description/>
<scmsync>http://localhost:3000/pool/test-GitPkgB#factory</scmsync>
</package>
114 changes: 114 additions & 0 deletions behave/container-files/opt/setup/gitea.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ function add_ssh_key {

create_org pool
create_org_repo pool test-GitPkgA
create_org_repo pool test-GitPkgB
create_org_repo pool test-GitPkgC
create_org openSUSE
create_org_repo openSUSE Leap
add_ssh_key admin $TOKEN_ADMIN /root/.ssh/admin.pub
add_ssh_key alice $TOKEN_ALICE /root/.ssh/alice.pub
add_ssh_key bob $TOKEN_BOB /root/.ssh/bob.pub
Expand Down Expand Up @@ -143,6 +147,116 @@ popd
$OSC api -X PUT '/source/test:factory/test-GitPkgA/_meta' --file "$TOPDIR"/fixtures/pac/test-GitPkgA.xml


# create test-GitPkgB package based on test-pkgA
# * change the package name
# * use changelog dates as commit/commiter dates for reproducibility

GITDIR="$(mktemp -d)"
pushd "$GITDIR"

git init --initial-branch factory
# git commiter equals to the configured user
git config user.name "Geeko Packager"
git config user.email "email@example.com"

cp -a "$TOPDIR"/fixtures/pac/test-pkgA-1.spec test-GitPkgB.spec
cp -a "$TOPDIR"/fixtures/pac/test-pkgA-1.changes test-GitPkgB.changes
sed 's@test-pkgA@test-GitPkgB@' -i *
git add *
DATE="2022-01-03 11:22:33 UTC"
GIT_COMMITTER_DATE="$DATE" git commit -a -m "Initial commit" --date "$DATE"

cp -a "$TOPDIR"/fixtures/pac/test-pkgA-2.spec test-GitPkgB.spec
cp -a "$TOPDIR"/fixtures/pac/test-pkgA-2.changes test-GitPkgB.changes
sed 's@test-pkgA@test-GitPkgB@' -i *
git add *
DATE="2022-01-04 11:22:33 UTC"
GIT_COMMITTER_DATE="$DATE" git commit -a -m "Version 2" --date "$DATE"

cp -a "$TOPDIR"/fixtures/pac/test-pkgA-3.spec test-GitPkgB.spec
cp -a "$TOPDIR"/fixtures/pac/test-pkgA-3.changes test-GitPkgB.changes
sed 's@test-pkgA@test-GitPkgB@' -i *
git add *
DATE="2022-01-05 11:22:33 UTC"
GIT_COMMITTER_DATE="$DATE" git commit -a -m "Version 3" --date "$DATE"

git remote add origin http://admin:opensuse@localhost:3000/pool/test-GitPkgB.git
git push --set-upstream origin factory

popd

# create test-GitPkgB package in test:factory that has scmsync set to gitea
$OSC api -X PUT '/source/test:factory/test-GitPkgB/_meta' --file "$TOPDIR"/fixtures/pac/test-GitPkgB.xml


# create test-GitPkgC package based on test-pkgA
# * change the package name
# * use changelog dates as commit/commiter dates for reproducibility

GITDIR="$(mktemp -d)"
pushd "$GITDIR"

git init --initial-branch factory
# git commiter equals to the configured user
git config user.name "Geeko Packager"
git config user.email "email@example.com"

cp -a "$TOPDIR"/fixtures/pac/test-pkgA-1.spec test-GitPkgC.spec
cp -a "$TOPDIR"/fixtures/pac/test-pkgA-1.changes test-GitPkgC.changes
sed 's@test-pkgA@test-GitPkgC@' -i *
git add *
DATE="2022-01-03 11:22:33 UTC"
GIT_COMMITTER_DATE="$DATE" git commit -a -m "Initial commit" --date "$DATE"

cp -a "$TOPDIR"/fixtures/pac/test-pkgA-2.spec test-GitPkgC.spec
cp -a "$TOPDIR"/fixtures/pac/test-pkgA-2.changes test-GitPkgC.changes
sed 's@test-pkgA@test-GitPkgC@' -i *
git add *
DATE="2022-01-04 11:22:33 UTC"
GIT_COMMITTER_DATE="$DATE" git commit -a -m "Version 2" --date "$DATE"

cp -a "$TOPDIR"/fixtures/pac/test-pkgA-3.spec test-GitPkgC.spec
cp -a "$TOPDIR"/fixtures/pac/test-pkgA-3.changes test-GitPkgC.changes
sed 's@test-pkgA@test-GitPkgC@' -i *
git add *
DATE="2022-01-05 11:22:33 UTC"
GIT_COMMITTER_DATE="$DATE" git commit -a -m "Version 3" --date "$DATE"

git remote add origin http://admin:opensuse@localhost:3000/pool/test-GitPkgC.git
git push --set-upstream origin factory

popd

# create test-GitPkgC package in test:factory that has scmsync set to gitea
$OSC api -X PUT '/source/test:factory/test-GitPkgC/_meta' --file "$TOPDIR"/fixtures/pac/test-GitPkgC.xml


# create openSUSE/Leap project repository with submodules test-GitPkgA, test-GitPkgB and test-GitPkgC

GITDIR="$(mktemp -d)"
pushd "$GITDIR"

git init --initial-branch factory
git config user.name "Geeko Packager"
git config user.email "email@example.com"
git remote add origin http://admin:opensuse@localhost:3000/openSUSE/Leap.git

# Add test-GitPkgA as a submodule
git submodule add -b factory ../../pool/test-GitPkgA.git test-GitPkgA
# Add test-GitPkgB as a submodule
git submodule add -b factory ../../pool/test-GitPkgB.git test-GitPkgB
# Add test-GitPkgC as a submodule
git submodule add -b factory ../../pool/test-GitPkgC.git test-GitPkgC

git add .gitmodules test-GitPkgA test-GitPkgB test-GitPkgC
DATE="2022-01-06 11:22:33 UTC"
GIT_COMMITTER_DATE="$DATE" git commit -a -m "Add package submodules" --date "$DATE"

git push --set-upstream origin factory

popd


# gitea-action-runner
systemctl enable podman.socket
systemctl enable gitea-action-runner.service
Expand Down
Loading