Migrate from github to ungleich gitlab

This commit is contained in:
Darko Poljak 2018-12-30 11:59:34 +01:00 committed by Darko Poljak
parent 3ca337dfe0
commit 8b93bf0218
9 changed files with 112 additions and 78 deletions
bin
cdist/conf/type
__cdist
man.rst
parameter/default
__git
docs

View file

@ -209,35 +209,30 @@ eof
fi
gpg --armor --detach-sign "${archivename}" || exit 1
# make github release
curl -H "Authorization: token ${token}" \
--request POST \
--data "{ \"tag_name\":\"${tag}\", \
\"target_commitish\":\"master\", \
\"name\": \"${tag}\", \
\"body\":\"${tag}\", \
\"draft\":false, \
\"prerelease\": false}" \
"https://api.github.com/repos/ungleich/cdist/releases" || exit 1
project="ungleich-public%2Fcdist"
sed_cmd='s/^.*"markdown":"\([^"]*\)".*$/\1/'
# get release ID
repoid=$(curl "https://api.github.com/repos/ungleich/cdist/releases/tags/${tag}" \
| python3 -c 'import json; import sys; print(json.loads(sys.stdin.read())["id"])') \
# upload archive
response_archive=$(curl -f -X POST \
-H "PRIVATE-TOKEN: ${token}" \
-F "file=@${archivename}" \
"https://code.ungleich.ch/api/v4/projects/${project}/uploads" \
| sed "${sed_cmd}") || exit 1
# upload archive signature
response_archive_sig=$(curl -f -X POST \
-H "PRIVATE-TOKEN: ${token}" \
-F "file=@${archivename}.asc" \
"https://code.ungleich.ch/api/v4/projects/${project}/uploads" \
| sed "${sed_cmd}") || exit 1
# make release
curl -f -X POST \
-H "PRIVATE-TOKEN: ${token}" \
-F "description=Release ${tag}<br/>${response_archive}<br/>${response_archive_sig}" \
"https://code.ungleich.ch/api/v4/projects/${project}/repository/tags/${tag}/release" \
|| exit 1
# upload archive and then signature
curl -H "Authorization: token ${token}" \
-H "Accept: application/vnd.github.manifold-preview" \
-H "Content-Type: application/x-gtar" \
--data-binary @${archivename} \
"https://uploads.github.com/repos/ungleich/cdist/releases/${repoid}/assets?name=${archivename}" \
|| exit 1
curl -H "Authorization: token ${token}" \
-H "Accept: application/vnd.github.manifold-preview" \
-H "Content-Type: application/pgp-signature" \
--data-binary @${archivename}.asc \
"https://uploads.github.com/repos/ungleich/cdist/releases/${repoid}/assets?name=${archivename}.asc" \
|| exit 1
# remove generated files (archive and asc)
if [ $# -eq 2 ]
@ -314,7 +309,7 @@ eof
"$0" release-git-tag
# sign git tag
printf "Enter github authentication token: "
printf "Enter upstream repository authentication token: "
read token
"$0" sign-git-release "${target_version}" "${token}"

View file

@ -244,34 +244,28 @@ eof
fi
gpg --armor --detach-sign "${archivename}" || exit 1
# make github release
curl -H "Authorization: token ${token}" \
--request POST \
--data "{ \"tag_name\":\"${tag}\", \
\"target_commitish\":\"master\", \
\"name\": \"${tag}\", \
\"body\":\"${tag}\", \
\"draft\":false, \
\"prerelease\": false}" \
"https://api.github.com/repos/ungleich/cdist/releases" || exit 1
project="ungleich-public%2Fcdist"
sed_cmd='s/^.*"markdown":"\([^"]*\)".*$/\1/'
# get release ID
repoid=$(curl "https://api.github.com/repos/ungleich/cdist/releases/tags/${tag}" \
| python3 -c 'import json; import sys; print(json.loads(sys.stdin.read())["id"])') \
|| exit 1
# upload archive
response_archive=$(curl -f -X POST \
-H "PRIVATE-TOKEN: ${token}" \
-F "file=@${archivename}" \
"https://code.ungleich.ch/api/v4/projects/${project}/uploads" \
| sed "${sed_cmd}") || exit 1
# upload archive and then signature
curl -H "Authorization: token ${token}" \
-H "Accept: application/vnd.github.manifold-preview" \
-H "Content-Type: application/x-gtar" \
--data-binary @${archivename} \
"https://uploads.github.com/repos/ungleich/cdist/releases/${repoid}/assets?name=${archivename}" \
|| exit 1
curl -H "Authorization: token ${token}" \
-H "Accept: application/vnd.github.manifold-preview" \
-H "Content-Type: application/pgp-signature" \
--data-binary @${archivename}.asc \
"https://uploads.github.com/repos/ungleich/cdist/releases/${repoid}/assets?name=${archivename}.asc" \
# upload archive signature
response_archive_sig=$(curl -f -X POST \
-H "PRIVATE-TOKEN: ${token}" \
-F "file=@${archivename}.asc" \
"https://code.ungleich.ch/api/v4/projects/${project}/uploads" \
| sed "${sed_cmd}") || exit 1
# make release
curl -f -X POST \
-H "PRIVATE-TOKEN: ${token}" \
-F "description=Release ${tag}<br/>${response_archive}<br/>${response_archive_sig}" \
"https://code.ungleich.ch/api/v4/projects/${project}/repository/tags/${tag}/release" \
|| exit 1
# remove generated files (archive and asc)
@ -349,7 +343,7 @@ eof
"$0" release-git-tag
# sign git tag
printf "Enter github authentication token: "
printf "Enter upstream repository authentication token: "
read token
"$0" sign-git-release "${target_version}" "${token}"

View file

@ -30,7 +30,7 @@ username
source
Select the source from which to clone cdist from.
Defaults to "git://github.com/ungleich/cdist.git".
Defaults to "git://code.ungleich.ch/ungleich-public/cdist.git".
branch
@ -47,7 +47,7 @@ EXAMPLES
__cdist /home/cdist/cdist
# Use alternative source
__cdist --source "git://github.com/ungleich/cdist" /home/cdist/cdist
__cdist --source "git://code.ungleich.ch/ungleich-public/cdist" /home/cdist/cdist
AUTHORS

View file

@ -1 +1 @@
git://github.com/ungleich/cdist.git
git://code.ungleich.ch/ungleich-public/cdist.git

View file

@ -44,7 +44,7 @@ EXAMPLES
__git /home/services/dokuwiki --source git://github.com/splitbrain/dokuwiki.git
# Checkout cdist, stay on branch 2.1
__git /home/nico/cdist --source git://github.com/ungleich/cdist.git --branch 2.1
__git /home/nico/cdist --source git://code.ungleich.ch/ungleich-public/cdist.git --branch 2.1
AUTHORS

View file

@ -0,0 +1,50 @@
#!/bin/sh -e
set -x
printf "Enter tag name: "
read tag
printf "Enter repository authentication token: "
read token
git tag -d "${tag}" || :
git tag "${tag}" -m "Release ${tag}"
git push origin "${tag}"
echo 'foo' > foo
echo 'foo signature' > foo.asc
archivename="foo"
project="poljakowski%2Fmy-cdist-testing"
sed_cmd='s/^.*"markdown":"\([^"]*\)".*$/\1/'
# upload archive
response_archive=$(curl -f -X POST \
-H "PRIVATE-TOKEN: ${token}" \
-F "file=@${archivename}" \
"https://code.ungleich.ch/api/v4/projects/${project}/uploads" \
| sed "${sed_cmd}") || exit 1
# upload archive signature
response_archive_sig=$(curl -f -X POST \
-H "PRIVATE-TOKEN: ${token}" \
-F "file=@${archivename}.asc" \
"https://code.ungleich.ch/api/v4/projects/${project}/uploads" \
| sed "${sed_cmd}") || exit 1
# make release
curl -f -X POST \
-H "PRIVATE-TOKEN: ${token}" \
-F "description=Release ${tag}<br/>${response_archive}<br/>${response_archive_sig}" \
"https://code.ungleich.ch/api/v4/projects/${project}/repository/tags/${tag}/release" \
|| exit 1
# get tag
curl -f -X GET \
-H "PRIVATE-TOKEN: ${token}" \
"https://code.ungleich.ch/api/v4/projects/${project}/repository/tags/${tag}" \
|| exit 1
rm -f foo foo.asc

View file

@ -16,7 +16,7 @@ Reporting bugs
--------------
If you believe you've found a bug and verified that it is
in the latest version, drop a mail to the cdist mailing list,
subject prefixed with "[BUG] " or create an issue on github.
subject prefixed with "[BUG] " or create an issue on code.ungleich.ch.
Coding conventions (everywhere)
@ -51,7 +51,7 @@ work nor kill the authors brain:
As soon as your work meets these requirements, write a mail
for inclusion to the mailinglist **cdist-configuration-management at googlegroups.com**
or open a pull request at http://github.com/ungleich/cdist.
or open a merge request at https://code.ungleich.ch/ungleich-public/cdist.
How to submit a new type
@ -76,7 +76,7 @@ The following workflow works fine for most developers
.. code-block:: sh
# get latest upstream master branch
git clone https://github.com/ungleich/cdist.git
git clone https://code.ungleich.ch/ungleich-public/cdist.git
# update if already existing
cd cdist; git fetch -v; git merge origin/master
@ -88,22 +88,22 @@ The following workflow works fine for most developers
# *hack*
*hack*
# clone the cdist repository on github if you haven't done so
# clone the cdist repository on code.ungleich.ch if you haven't done so
# configure your repo to know about your clone (only once)
git remote add github git@github.com:YOURUSERNAME/cdist.git
git remote add ungleich git@code.ungleich.ch:YOURUSERNAME/cdist.git
# push the new branch to github
git push github documentation_cleanup
# push the new branch to ungleich gitlab
git push ungleich documentation_cleanup
# (or everything)
git push --mirror github
git push --mirror ungleich
# create a pull request at github (use a browser)
# create a merge request at ungleich gitlab (use a browser)
# *fixthingsbecausequalityassurancefoundissuesinourpatch*
*hack*
# push code to github again
# push code to ungleich gitlab again
git push ... # like above
# add comment that everything should be green now (use a browser)

View file

@ -36,10 +36,13 @@ To install cdist, execute the following commands:
.. code-block:: sh
git clone https://github.com/ungleich/cdist.git
git clone https://code.ungleich.ch/ungleich-public/cdist.git
cd cdist
export PATH=$PATH:$(pwd -P)/bin
From version 4.2.0 cdist tags and releases are signed.
You can get GPG public key used for signing `here <_static/pgp-key-EFD2AE4EC36B6901.asc>`_.
To install cdist with distutils from cloned repository, first you have to
create version.py:
@ -74,14 +77,6 @@ So for instance if you want to use and stay with version 4.1, you can use
git checkout -b 4.1 origin/4.1
Git mirrors
^^^^^^^^^^^
If the main site is down, you can acquire cdist from one of the following sites:
* git://github.com/telmich/cdist.git `github <https://github.com/telmich/cdist>`_
* git://git.code.sf.net/p/cdist/code `sourceforge <https://sourceforge.net/p/cdist/code>`_
Building and using documentation (man and html)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -56,7 +56,7 @@ code into your shell to get started and configure localhost::
# Get cdist
# Mirrors can be found on
# http://www.nico.schottelius.org/software/cdist/install/#index2h4
git clone git://github.com/ungleich/cdist
git clone git://code.ungleich.ch/ungleich-public/cdist
# Create manifest (maps configuration to host(s)
cd cdist