跳至主要内容

博文

目前显示的是 2024的博文

Dynamic validation of Jenkins parameters

原文链接 If you have developed CI/CD or Automation pipelines using Jenkins, you must have faced the challenge that there is a lack of one such parameter which can validate the input and show error message to user before they hit the build button. This was the headache I also experienced. After some research and playing with different plugins, I found that I can solve this with the help of Active Choices Plugin. Active Choices Plugin Active Choices Plugin provides three useful parameter types which can be updated dynamically with the help of groovy script. We are going to use Active Choices Reactive Reference Parameter for our use case. Active Choices Reactive Reference Parameter can read other input parameters and can be modified to show custom html dynamically (i.e. before clicking the build button.) Use Case We are going to observe the following use case here: We need a Jenkins pipeline which takes three string parameters: EMAIL_IDS, GITHUB_REPO and GITHUB_BRANCH. EMAIL_IDS and G...

Shadowsocks自定义PAC规则

 原文链接 ShadowSocks 默认使用 GFWList 规则和使用 adblock plus 的引擎。要想自己添加自定义的用户规则,最好熟悉一下其规则: 中文版: Adblock Plus 过滤规则 自定义代理规则的设置语法与 GFWlist 相同,语法规则如下: 通配符支持。 比如  *.example.com/* 实际书写时可省略  *  , 如 .example.com/  和  *.example.com/*  效果一样 正则表达式支持。 以  \  开始和结束, 如  \[\w]+:\/\/example.com\ 例外规则  @@ 如  @@*.example.com/*  满足  @@  后规则的地址不使用代理 匹配地址开始和结尾  | 如  |http://example.com  、  example.com|  分别表示以  http://example.com  开始和以  example.com  结束的地址 || 标记 如  ||example.com  则  http://example.com  、 https://example.com  、  ftp://example.com  等地址址满足条件。 注释  ! 如  !我是注释 分隔符 ^ 表示除了字母、数字或者 _ - . % 之外的任何字符。如  http://example.com^  , http://example.com/  和  http://example.com:8000/  均满足条件,而  http://example.com.ar/  不满足条件。

在 macOS 上使用 Finder 安装 IPCC (运营商配置文件)

IPCC 是运营商配置文件,负责控制手机卡的相关配置信息,比如是否有 5G 开关、VoLTE 开关选项。 从系统镜像中提取 IPCC 文件 下载最新版本的系统镜像,比如 12Pro iOS 15.5 的文件名是  iPhone13,2,iPhone13,3_15.5_19F77_Restore.ipsw 。 把后缀名由  ipsw  改为  zip ,使用系统的归档程序直接解压,得到目录  iPhone13,2,iPhone13,3_15.5_19F77_Restore 。 不同机型的 IPCC 文件不要混用,否则可能会导致信号异常或者丢失某些数据选项的问题,比如 8Plus 刷 12Pro 的 IPCC,「蜂窝数据选项」里就只剩下「低数据模式」这个选项了。 目录里面有几个  .dmg  文件,体积最大就是系统镜像了,里面包含了所有的系统文件,其中也包括所有的 IPCC 文件。 直接双击挂载这个 dmg 文件,进入目录  System/Library/Carrier Bundles/iPhone ,里面的  *.bundle  就是 IPCC 文件。 制作 IPCC 刷机包 新建一个目录,名称为  Payload  ,把自己需要的运营商配置  *.bundle  文件拖进这个  Payload  目录里(注:Payload 目录里只能放一个  bundle  文件,多个安装会失败)。 压缩  Payload  目录,得到  Payload.zip  ,然后改后缀为  .ipcc ,最后的文件名称是  Payload.ipcc 。 使用 Finder 刷入 IPCC 开启对 IPCC 文件的支持: defaults write com.apple.AMPDevicesAgent carrier-testing -bool YES 接入手机,在 Finder 里打开手机,按住  Option/Alt  键然后点击「更新」,在弹出来的文件选择框中选择刚才创建的  Payload.ipcc ,安装成功或者失败都...

In a declarative jenkins pipeline - can I set the agent label dynamically?

原文链接 To see how this works, use a GString object to do a println and return the variable for the agentName at the same time. You can see from the output that this line evaluates well before any of the other pipeline code. agentName = "Windows" agentLabel = "${println 'Right Now the Agent Name is ' + agentName; return agentName}" pipeline { agent none stages { stage('Prep') { steps { script { agentName = "Linux" } } } stage('Checking') { steps { script { println agentLabel println agentName } } } stage('Final') { agent { label agentLabel } steps { script { println agentLabel println agentName } } ...

Thinking in RxSwift

 原文链接 It has been a long time since my last post. I wanted to prepare an article which will cover the theory which stands behind  Observable  and show the usage on real, not dummy example. It has turned out it was not trivial task as I thought 😉 The article is split into 2 parts. At the beginning, I try to explain what is the  Observable  and how should you treat them. The second part is a tutorial how to implement a search of Spotify tracks using  RxSwift . A theory is a theory, but an example is a thing which makes a subject easier to understand. To cut a long story short, I hope you will enjoy reading 🙂 Observable – a sequence The thing which holds people down before jumping into next level while using Rx is the  thinking in an imperative way . You have to break old habits and start to think in the Rx way. I recommend you to think about  Observable   like about an array . This is because, you can  map ,  filter ,  reduce ...