I can believe fly.

Wednesday, March 27, 2019

GIT学习-修改本地和远程的commit的作者信息

如果第一条记录,执行:
  1. 修改本地记录git commit --amend --author "ysl<ysl@qq.com>" -m"update info"
  2. 获取远程信息 git fetch
  3. 推送修改 git push --force-with-lease
如果不是第一条(第N条),则

  1. git rebase -i commit_id(第N+1条记录的commitId)
  2. git commit --amend --author "ysl<ysl@qq.com>" -m"update info" (修改信息,则 git commit --amend, 然后Enter 保存)
  3. git rebase --continue
  4. git fetch
  5. git push --force-with-lease

Wednesday, February 13, 2019

自动获取Jenkins agent secret值

背景:从Jenkins 2.0开始,slave的启动需要有个SECRET值
问题:如何自动获取SECRET值
【linux下版本】
JENKINS_AGENT_SECRET=$(curl --user $JENINS_CREDENTIALS --connect-timeout 60 -m 120 -L $JENKINS_AGENT_PAGE_URL 2> /dev/null \
                            | grep ' \-secret ' | grep -Eo '\-secret .+? ' | cut -d' ' -f2 | tr -d ' \t\n\r')

【window下版本】

FOR /F "usebackq" %%t IN (`curl -L -s -u %JENINS_CREDENTIALS% -X GET %JENKINS_AGENT_JNLP_URL% ^| sed "s/.*\([a-z0-9]*\).*/\1/"`) DO set JENKINS_AGENT_SECRET=%%t

注意:在batch下,管道|需要使用^来进行转义

Sunday, November 18, 2018

execl函数使用记20181119


源数据:B1=projectname-android   或者projectname-ios

连接字符串
CONCATENATE(“https://cibuild.ysl.com/jenkins/job/“,B1)      # https://cibuild.ysl.com/jenkins/job/projectname-android

从某个字符截取
=MID(B1,FIND("-",B1),LEN(B1))     #输出:-android

连接字符串
=CONCATENATE("git", MID(B1,FIND("-",B1),LEN(B1)))     #输出:git-android

 替换字符
=SUBSTITUTE(B1, MID(B1,FIND("-",B1),LEN(B1)), CONCATENATE("git", MID(B1,FIND("-",B1),LEN(B1))) )      #输出:projectnamegit-android

继续拼接字符串
CONCATENATE(“https://cibuild.ysl.com/jenkins/job“, SUBSTITUTE(B1, MID(B1,FIND("-",B1),LEN(B1)), CONCATENATE("git", MID(B1,FIND("-",B1),LEN(B1))) ))

#输出: https://cibuild.ysl.com/jenkins/job/projectnamegit-android

Thursday, August 23, 2018

sonar + ldap 配置

参考资料:

https://www.linuxhub.org/doc/install.sonarqube.ldap.html

配置内容:
LDAP configuration
# General Configuration
sonar.security.realm=LDAP
ldap.url=ldap://ip地址:389

# User Configuration
ldap.user.baseDn=dc=yusulian,dc=com
ldap.user.request=(&(objectClass=inetOrgPerson)(cn={login}))
ldap.user.emailAttribute=mail
ldap.user.realNameAttribute=displayname
# Group Configuration

#ldap.group.baseDn=cn={0} 

注意:LDAP创建用户组的时候使用objectClass的属性 
用户使用的是inetOrgPerson 
用户组使用的是posixGroup 
这个创建用户与使用用户的应用程序需要一致。


Saturday, July 21, 2018

ant 实现字符串小写转大写

ant 实现字符串小写转大写
project.setProperty( attributes.get( "to" ),
attributes.get( "string" ).toUpperCase() );
 
 参考资料

Wednesday, June 27, 2018

docker 日常操作命令集

查看容器
docker ps -a

删除容器
docker rm 3b2620dd77cf

查看镜像
docker images

删除镜像
docker rmi  本地镜像名称:tag名称
docker rmi  IMAGEID   (会碰到image is referenced in multiple repositories)

获取镜像
docker pull 远程镜像

为镜像打标答
docker tag 本地镜像名称:tag名称  远程镜像仓库名称:tag名称

推送打好的标答到远程仓库

docker push  远程镜像仓库名称:tag名称 

GIT学习-两个git仓库迁移操作

命令行:
1. 创建新仓库
2. 以bare方式clone旧仓库:
    git clone —bare  旧仓库

3. 以镜像方式推送到新仓库
       cd 旧仓库
    git push --mirror 新仓库远程地址

4. 如果想保留本地暂存stash的修改记录,更换远程指向地址

    git remote set-url origin remote_git_address 


界面式:
在界面创建项目时选择Import project -》Repo by URL按指引操作