Implement Scala Steward in Gitlab for private repo - scala

I am attempting to implement Scala-Steward for private project.
Here's my repo: https://gitlab.com/mukhtar1227ali/myscala-steward-test
the build runs successfully and the bot is able to create new PRs and make the necessary changes. However, I am not seeing any jobs running in the PRs
https://gitlab.com/mukhtar1227ali/myscala-steward-test/-/jobs/3661402645
"I am encountering an error in which the 'git commit' command is failing with exit code 128, :
org.scalasteward.core.io.process$ProcessFailedException: 'GIT_ASKPASS=/builds/mukhtar1227ali/myscala-steward-test/pass.sh FOO=BAR git -c core.hooksPath=/dev/null commit --all --gpg-sign -m Update kafka-clients to 3.3.2' exited with code 128.
error: cannot run gpg: No such file or directory
error: gpg failed to sign the data
fatal: failed to write commit object
at org.scalasteward.core.io.process$.$anonfun$slurp$7(process.scala:75)
at org.scalasteward.core.io.process$.$anonfun$slurp$7$adapted(process.scala:69)
at flatMap # org.scalasteward.core.io.process$.$anonfun$slurp$5(process.scala:69)
at flatMap # fs2.Compiler$Target.flatMap(Compiler.scala:163)
at flatMap # fs2.Compiler$Target.flatMap(Compiler.scala:163)
at flatMap # fs2.Compiler$Target.flatMap(Compiler.scala:163)
at flatMap # fs2.Compiler$Target.flatMap(Compiler.scala:163)
at flatMap # fs2.Compiler$Target.flatMap(Compiler.scala:163)
at flatMap # fs2.Compiler$Target.flatMap(Compiler.scala:163)
at modify # fs2.internal.Scope.close(Scope.scala:262)
at flatMap # fs2.Compiler$Target.flatMap(Compiler.scala:163)
at rethrow$extension # fs2.Compiler$Target.$anonfun$compile$1(Compiler.scala:157)
at as # org.scalasteward.core.io.process$.$anonfun$readLinesIntoBuffer$1(process.scala:123)
at get # fs2.internal.Scope.openScope(Scope.scala:281)
at flatMap # fs2.Compiler$Target.flatMap(Compiler.scala:163)
at flatMap # fs2.Pull$.$anonfun$compile$21(Pull.scala:1213)
at update # fs2.internal.Scope.releaseChildScope(Scope.scala:224) ```

Related

is there a mylyn connector for Gitlab?

I worked with bugzilla and Eclipse, and I used Mylyn to manage issues though Eclipse.
Now I use Gitlab and gitlab issues, I wonder if there is a mylyn connector for Gitlab ?
I knwow that there is this one : gitlab connector , but it is no more usable and I did not found another one.
Did someone face with the same problem and did find a solution ?
After a while I can share my solution, maybe it will help others.
There is no Mylin connector for Gitlab that runs correctly. A solution could be to debug the buggy one but in fact Gitlab is not a powerfull tool to manage issues.
I chose to use Bugzilla at least for three points :
the bug workflow is easy to customize and this is an important feature to adapt the bug workflow to the company processes
Mylin connector for Bugzilla is avalaible since a long time and runs correctly
Bugzilla is still a reference tool
The first step is to define Bugzilla as the issues management tool, this is done through Gitlab UI and the documentation is here.
For me, if an external tool is used, the best is to desactivate Gitlab issues tracking. On your project, go to Settings->General->Visibility, project features and desactivate Issues.
Note: if Bugzilla and Gitlab are deployed on the same host, you have to accept request to localhost. On Gitlab administration, go to Settings->Network->Outbound requests, select the two options about local network.
After that, you can comment your commits with a message containing Ref #id where id is a bug id in Bugzilla. As with Gitlab issue, the commit will contain an hyperlink to the issue but the hyperlink will open Bugzilla bug page.
If you do not go further, you will lost a Gitlab feature : Gitlab issue references all commits related to it.
A solution to have a similar feature with Bugzilla is to add to bug a comment with an hyperlink to commits.
This could be achieve with a server hook, this is described here.
Note : each time you change the gitlab.rb file, do no forget to execute gitlab-ctl reconfigure.
The hook has to manage "standard" commit and merge commits.
The following python code could be seen as a starting point for a such hook.
It assumes that development are done on branches named feature/id nd that commits comments contains a string Ref #id. Id is a bug id.
It could be improve:
to manage exceptions better
to manage more push cases
to check more rules such as :
the bug has to be in progess
the bug assignee has to be the git user who performs the push
the bugzilla project has to be the one for the Gitlab project
the bug is open on a version that is still under development or debug
....
#!/usr/bin/env python3
import sys
import os
import fileinput
import glob
import subprocess
import requests
#
# Constants
#
G__GIT_CMD =["git","rev-list","--pretty"]
G__SEP ="commit "
G__NL ='\n'
G__AUTHOR ='Author'
G__AUTHOR_R ='Author: '
G__DATE ='Date'
G__DATE_R ='Date: '
G__C_MSG ='message'
G__URL_S ='https://<<gitlab server url>>/<<project>>/-/commit/'
G__MERGE_S ='Merge: '
G__MERGE ='Merge'
G__URL ='URL'
G__BUGZ_URL ='http://<<bugzilla url>>/rest/bug/{}/comment'
G__HEADERS = {'Content-type': 'application/json'}
G__JSON = {"Bugzilla_login":"<<bugzilla user>>","Bugzilla_password":"<<password>>","comment": "{}"}
G__JSON_MR = {"Bugzilla_login":"<<bugzilla user>>","Bugzilla_password":"<<password>>","comment": "Merge request {}"}
G__COMMENT_ELEM = 'comment'
G__MSG_REF ="Ref #"
G__MSG_REF_MR ="feature/"
G__WHITE =" "
G__APOS ="'"
#
# Filters some parts of message that are empty
#
def filter_message_elements(message_elements):
flag=False
for message_element in message_elements:
if len(message_element)!=0:
flag=True
return flag
#
# Add an element in commit dictionary.
#
# If this is a commit for a merge, an element is added.
#
def add_commit_in_dict(commits_dict, temp_list, flag_merge):
url = G__URL_S+temp_list[0]
commits_dict[temp_list[0]]={}
commits_dict[temp_list[0]][G__URL]=url
if False==flag_merge:
commits_dict[temp_list[0]][G__AUTHOR]=temp_list[1].replace(G__AUTHOR_R,'')
commits_dict[temp_list[0]][G__DATE]=temp_list[2].replace(G__DATE_R,'')
commits_dict[temp_list[0]][G__C_MSG]=temp_list[3]
else:
commits_dict[temp_list[0]][G__MERGE]=temp_list[1]
commits_dict[temp_list[0]][G__AUTHOR]=temp_list[2].replace(G__AUTHOR_R,'')
commits_dict[temp_list[0]][G__DATE]=temp_list[3].replace(G__DATE_R,'')
commits_dict[temp_list[0]][G__C_MSG]=temp_list[4]
#
# Fill commits data
#
def fills_commit_data(commits_dict, fileinput_line):
params=fileinput_line[:-1].split()
try:
# Git command to get commits list
cmd=G__GIT_CMD+[params[1],"^"+params[0]]
rev_message = subprocess.run(cmd,stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
# loop on commits
messages_list=rev_message.stdout.split(G__SEP)
for message in messages_list:
if len(message)==0:
continue
message_elements = message.split(G__NL)
# filters empty message
flag=filter_message_elements(message_elements)
if not flag:
continue
# Extracts commit data and detects merge commit
temp_list=[]
flag_merge=False
for message_element in message_elements:
text = message_element.strip()
if 0!=len(text):
temp_list.append(text)
if -1!=text.find(G__MERGE):
flag_merge=True
# adds the commit in commits dictionary
add_commit_in_dict(commits_dict, temp_list, flag_merge)
except Exception as inst:
sys.exit(1)
#
# Extract the bug id from the commit message
#
def find_bug_id(message):
issue_int=-1
pos=message.find(G__MSG_REF)
if pos==-1:
sys.exit(1)
issue_nb=message[pos+len(G__MSG_REF):]
pos2=issue_nb.find(G__WHITE)
issue_nb=issue_nb[:pos2]
try:
issue_int=int(issue_nb)
except ValueError:
sys.exit(1)
return(issue_int)
#
# Extract the bug id from the commit message
# in case of merge request
#
def find_bug_id_mr(message):
issue_int=-1
pos=message.find(G__MSG_REF_MR)
if pos==-1:
sys.exit(1)
issue_nb=message[pos+len(G__MSG_REF_MR):]
pos2=issue_nb.find(G__APOS)
issue_nb=issue_nb[:pos2]
try:
issue_int=int(issue_nb)
except ValueError:
sys.exit(1)
return(issue_int)
#
# Checks if the commit list contains a merge request commit
#
def is_merge_request(commits_dict):
flag=False
for key in commits_dict:
if G__MERGE in commits_dict[key]:
flag=True
break
return flag
#
# Add a comment to a bug
#
def add_comment_to_bug( commit_data):
bug_id = find_bug_id(commit_data[G__C_MSG])
url = G__BUGZ_URL.format(str(bug_id))
G__JSON[G__COMMENT_ELEM] = G__JSON[G__COMMENT_ELEM].format(commit_data[G__URL])
response = requests.post(url, json=G__JSON, headers=G__HEADERS)
#
# add a comment in case of merge request
#
def add_mr_comment_to_bug(commits_dict):
commit_data=None
for key in commits_dict:
if G__MERGE in commits_dict[key]:
commit_data=commits_dict[key]
break
bug_id = find_bug_id_mr(commit_data[G__C_MSG])
url = G__BUGZ_URL.format(str(bug_id))
G__JSON_MR[G__COMMENT_ELEM] = G__JSON_MR[G__COMMENT_ELEM].format(commit_data[G__URL])
response = requests.post(url, json=G__JSON_MR, headers=G__HEADERS)
#
# Main program
#
def main():
# dictionary containing all commits
commits_dict={}
# loop on inputs referencing data changes
for fileinput_line in sys.stdin:
fills_commit_data(commits_dict, fileinput_line)
# find if this is merge request or not
flag_merge_request = is_merge_request(commits_dict)
if False==flag_merge_request:
# loop on commit to add comments to bugs
for key in commits_dict.keys():
add_comment_to_bug(commits_dict[key])
else:
# in case of merge request, only the merge commit has to be added
# others commits have been processed before
add_mr_comment_to_bug(commits_dict)
if __name__ == "__main__":
main()

Buildroot Package Makefile: How to fetch the most recent commit from git?

I am working on adding my own module to the build of buildroot using $BR2_External. The make file of my package is as follows,
##############################################################
#
# GPIO
#
##############################################################
GPIO_VERSION = '2851a05c9b613c1736f79faa185a11118b229852'
GPIO_SITE = '<URL of git repo>'
GPIO_SITE_METHOD = git
GPIO_GIT_SUBMODULES = YES
GPIO_MODULE_SUBDIRS = GPIO_driver/
# GPIO_MODULE_SUBDIRS += GPIO_driver/
# define LDD_BUILD_CMDS
# $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(#D)/misc-modules
# $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(#D)/scull
# endef
#
# # TODO add your writer, finder and finder-test utilities/scripts to the installation steps below
define GPIO_INSTALL_TARGET_CMDS
#module
# $(INSTALL) -m 0755 $(#D)/01_simple_LKM/* $(TARGET_DIR)/usr/bin
$(INSTALL) -m 0755 $(#D)/GPIO_driver/* $(TARGET_DIR)/usr/bin
endef
$(eval $(kernel-module))
$(eval $(generic-package))
This make file always pulls only a specific commit (mentioned in GPIO_VERSION variable) from gitHub. This is getting a little frustrating as, everytime I push new code to git I have to update the make file with the new commit number as well. So, is there any way to write the make file such that the most recent commit is pulled.

How to contribute to homebrew-cask using GitHub?

The quotation below is the instruction to contribute to brew-cask. However, I could not understand the sentence: github_user='<my-github-username>', I do not know whether should I input <>, and what is the github_user?
There is one email address, two names for one single GitHub account. What is more, when I input the last sentence: cask-repair --pull origin --push $github_user $outdated_cask. There is 2 errors: the requested upstream branch 'Andy1984' does not exist, and
Error creating pull request: Unprocessable Entity (HTTP 422)
Invalid value for "head"
and the result is There was an error submitting the pull request. Have you forked the repo and made sure the pull and push remotes exist? I am quite sure I followed the instructions. What is wrong?
# install and setup script - only needed once
brew install vitorgalvao/tiny-scripts/cask-repair
cask-repair --help
# fork homebrew-cask to your account - only needed once
cd "$(brew --repository)/Library/Taps/caskroom/homebrew-cask/Casks"
hub fork
# use to update <outdated_cask>
outdated_cask='<the-cask-i-want-to-update>'
github_user='<my-github-username>'
cd "$(brew --repository)/Library/Taps/caskroom/homebrew-cask/Casks"
cask-repair --pull origin --push $github_user $outdated_cask
According to the documentation you can also use a script to push new version of an existing cask.
Check: https://github.com/caskroom/homebrew-cask/blob/master/CONTRIBUTING.md#updating-a-cask
# install and setup script - only needed once
brew install vitorgalvao/tiny-scripts/cask-repair
cask-repair --help
# use to update <outdated_cask>
cask-repair <outdated_cask>

In Bazaar (bzr), How to show log of only commits which were done in a specific branch nick?

In Mercurial (hg), a user can enter the following command --
hg log --branch branchName
This shows only the commits which were done against a specific named branch.
What bzr command can give me the same functionality? I could not find an option for "bzr log" that would do the same thing. For example, if I committed revs 1, 2, and 3 in branch nick "trunk" and 2.1.1, 2.1.2, and 4 in branch nick "ftr-foo", how can I print only the revs under branch nick "ftr-foo" such that I'd only see 2.1.1, 2.1.2, 4? And how would I get only the commits which were done against the "trunk" branch nick such that I'd only see 1, 2, and 3?
DAG graph below.
4 [ftr-foo]
| \
3 \ [trunk]
| \
| 2.1.2 [ftr-foo]
| |
| 2.1.1 [ftr-foo]
| /
| /
2 [trunk]
|
1 [trunk]
While Bzr has the basic machinery to allow matching commits by other criteria, this is still a non-trivial exercise in plugin writing. A simpler alternative is to filter the output of bzr log or bzr log -n0 through a grep-like program that understands where commits begin and end.
The following Python program (which should work with both Python 2.7 and Python 3.x) allows you to grep bzr log output for arbitrary regular expressions:
#!/usr/bin/env python
import sys, re, os
args = sys.argv[1:]
if not args or args in [["--help"], ["-h"], ["-help"]]:
prog = os.path.basename(sys.argv[0])
print("Usage: bzr log BZRARGS | " + prog + " REGEX ...")
sys.exit(1)
patterns = [re.compile(pat) for pat in args]
def handle(block):
match = False
for line in block:
for pattern in patterns:
if re.search(pattern, line):
match = True
break
if match:
break
if match:
try:
for line in block:
sys.stdout.write(line)
except IOError:
sys.exit(0)
def main():
sep = "^\s*------------------------------------------------------------$"
sep = re.compile(sep)
stdin = sys.stdin
block = []
while True:
line = stdin.readline()
if not line:
if block:
handle(block)
break
if re.match(sep, line):
if not block:
block.append(line)
else:
handle(block)
block = [ line ]
else:
block.append(line)
main()
If you call this program bzr-greplog, you can then do:
bzr log -n0 | bzr-greplog 'branch nick: foo'
to search for branches with the nick foo. Note that the pattern will match anywhere within a line, so it will match a nick of foobar also, for example, or a commit message that happens to have this pattern. In order to avoid (most) such false positives, use an anchored regex instead, e.g. '^\s*branch nick: foo$' (the \s* is necessary because indented commits may begin with spaces). You can also use a script that allows you to search specifically for a branch nick:
#!/bin/sh
bzr log -n0 | bzr-greplog '^\s*branch nick: '"$1"'$'
Known bug: If a commit message contains exactly a bzr log record separator (with the exact same number of dashes), then bzr-greplog will misinterpret the commit as two commits and may leave out the part following the separator.

svn2git error PROPFIND request failed

I have Ruby, RubyGems, and svn2git installed under 32 bit windows 7.
svn2git https://code.google.com/p/skyrim-plugin-decoding-project/ --rootistrunk --revision 1:1693 --authors ~/authors.txt --verbose
The above line returns the following error:
Running command: git svn init --prefix=svn/ --no-metadata --trunk=https://code.g
oogle.com/p/skyrim-plugin-decoding-project/
Initialized empty Git repository in e:/tes5edit/.git/
RA layer request failed: PROPFIND request failed on '/p/skyrim-plugin-decoding-p
roject': PROPFIND of '/p/skyrim-plugin-decoding-project': 405 Method Not Allowed
(https://code.google.com) at /usr/lib/perl5/site_perl/Git/SVN.pm line 310
command failed:
git svn init --prefix=svn/ --no-metadata --trunk=https://code.google.com/p/skyri
m-plugin-decoding-project/
I read something about svnadmin so I tried the following
svnadmin: E205000: Repository argument required
I don't know what the argument would be.
I have never used GitBash or any of these programs. I have no idea what the proper commands would be to resolve the issue. I am also new to Git and have very little experience with it.
git svn clone http://my-project.googlecode.com/svn/ \
--authors-file=users.txt --no-metadata -s my_project
The standard commands also give errors
E:\TES5Edit_Git> git svn init https://code.google.com/p/skyrim-plugin-decoding-p
roject/
Initialized empty Git repository in E:/TES5Edit_Git/.git/
E:\TES5Edit_Git [master]> git config svn.authorsfile ./authors.txt
E:\TES5Edit_Git [master +1 ~0 -0 !]> git svn fetch
RA layer request failed: PROPFIND request failed on '/p/skyrim-plugin-decoding-p
roject': PROPFIND of '/p/skyrim-plugin-decoding-project': 405 Method Not Allowed
(https://code.google.com) at /usr/lib/perl5/site_perl/Git/SVN.pm line 148
E:\TES5Edit_Git [master +1 ~0 -0 !]>
As long as it makes a repo I can push I don't care how I do it. However, I did not start with a standard setup in the beginning and no idea what I was doing. So I want the clone to start at commit 1 and consider root as master, and all commits that make any kind of folder, rename folders, move folders, delete folders, all of everything created as branches.
After asking some friends I realized I had been using the wrong URL.
svn2git http://skyrim-plugin-decoding-project.googlecode.com/svn/ --rootistrunk --revision 1:1693 --authors ~/authors.txt --verbose
That would have been the correct init statment