[Jenkins] JenkinsをUpdateしたらエラーでハマった問題

# はじめに
Jenkinsで新しいバージョンにしたところ下記のエラーになって使えなくなってしまった。
解消したやり方の忘却録

```
java.lang.IllegalStateException: An attempt to save the global configuration was made before it was loaded
```
![スクリーンショット 2021-12-24 12.05.56.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/1022988/367ec912-e12f-8b1b-076e-674f31fc8bdb.png)

## 前提
- Homevrewで「jenkins-lts」を使用

## やったこと
##### ①、`brew info jenkins-lts`でまず現在の情報を確認
```
jenkins-lts: stable 2.319.1 (bottled)
Extendable open-source CI server
https://www.jenkins.io/index.html#stable
/usr/local/Cellar/jenkins-lts/2.263.4 (7 files, 67.2MB) *
  Built from source on 2021-12-24 at 13:23:01
/usr/local/Cellar/jenkins-lts/2.277.1 (7 files, 70.9MB)
  Built from source on 2021-12-24 at 13:17:27
/usr/local/Cellar/jenkins-lts/2.277.4 (7 files, 70.9MB)
  Built from source on 2021-12-24 at 13:13:38
/usr/local/Cellar/jenkins-lts/2.289.1 (7 files, 74.0MB)
  Poured from bottle on 2021-12-24 at 12:01:49
/usr/local/Cellar/jenkins-lts/2.319.1 (8 files, 72.2MB)
  Poured from bottle on 2021-12-24 at 11:34:09
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/jenkins-lts.rb
License: MIT
==> Dependencies
Required: openjdk@11 ✔
==> Caveats
Note: When using launchctl the port will be 8080.

To restart jenkins-lts after an upgrade:
  brew services restart jenkins-lts
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/openjdk@11/bin/java -Dmail.smtp.starttls.enable=true -jar /usr/local/opt/jenkins-lts/libexec/jenkins.war --httpListenAddress=127.0.0.1 --httpPort=8080
==> Analytics
install: 4,780 (30 days), 15,102 (90 days), 62,524 (365 days)
install-on-request: 4,781 (30 days), 15,108 (90 days), 62,529 (365 days)
build-error: 0 (30 days)
```

##### ②、`/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula`に移動
##### ③、`git log --oneline jenkins-lts.rb` バージョン一覧を確認
```zsh
464ad19fe41 jenkins-lts: update 2.319.1 bottle.
16ad14ad681 jenkins-lts 2.319.1
8d7ce70778c jenkins-lts: update 2.303.3 bottle.
efb18adfa6a jenkins-lts 2.303.3
7e47b5825c8 jenkins-lts: update 2.303.2 bottle.
011e6b85725 jenkins-lts 2.303.2
276b7f954f6 jenkins-lts: update 2.303.1 bottle.
b674d1d04c8 jenkins-lts: update homepage
c9a9ee1bfc8 jenkins-lts: update 2.303.1 bottle.
3b002d1c05f jenkins-lts 2.303.1
c16b22eb2bf jenkins-lts: update 2.289.3 bottle.
df9e7d44c53 jenkins-lts: replace `plist` with `service`
a5038b50f51 jenkins-lts: update 2.289.3 bottle.
e08a02d32f3 jenkins-lts 2.289.3
b6926ffe30e jenkins-lts: update 2.289.2 bottle.
5f2cae66354 jenkins-lts 2.289.2
3a567e39af4 jenkins-lts: update 2.289.1 bottle.
429f97b381c jenkins-lts 2.289.1
14190b5777b jenkins-lts: add 2.277.4 bottle.
72f5bb488f3 jenkins-lts 2.277.4
a54a050d3fa jenkins-lts 2.277.3
27c28dda052 jenkins-lts 2.277.2 (#74753)
bab4933f7e1 jenkins-lts 2.277.1
54ef3077819 jenkins-lts: update livecheck
47d159b208a jenkins-lts: remove ambiguous regexp literals
db1df7d5bd0 jenkins-lts: use HTTPS urls.
3a3803f22e2 jenkins-lts 2.263.4 (#70853)
d67475d00fe jenkins-lts 2.263.3 (#69803)
584fc4d559e jenkins-lts 2.263.2
119da4ff5bb jenkins-lts 2.263.1 (#66075)
33f33460ec9 jenkins-lts 2.249.3 (#64136)
7920ad6d1d9 jenkins-lts 2.249.2
0c00b5a1ae0 jenkins-lts 2.249.1
9591758fd8a Add livecheck blocks from homebrew-livecheck
53548e17a6e jenkins-lts 2.235.5 (#59783)
bbea9bfcf72 jenkins-lts 2.235.4 (#59632)
34f30ced0b1 jenkins-lts 2.235.3 (#58790)
613790f173b jenkins-lts: fix RuboCop style.
d4992efefa7 jenkins-lts 2.235.2 (#58005)
6f9ac931b6f jenkins: use openjdk 11 (#57215)
b68c0358948 jenkins-lts 2.235.1
2d95073b0ae jenkins-lts 2.222.4
d4bad9e5f94 Merge pull request #52593 from bayandin/free_port-instead-of-predefined
1a17ffa6ba4 jenkins-lts 2.222.1 (#52264)
c070c77dd13 jenkins-lts 2.204.6 (#52159)
26ca9afb437 jenkins-lts: fix RuboCop Style/TrailingBodyOnMethodDefinition.
8b535e58670 jenkins-lts 2.204.5 (#51299)
68e2cce51ce jenkins-lts 2.204.4 (#51072)
```

##### ④、以前のバージョンは動いていたので以前のバージョンを探して戻す
```
git checkout 3a3803f22e2 jenkins-lts.rb
brew unlink jenkins-lts
brew install jenkins-lts
brew services restart jenkins-lts
cd ~/Library/LaunchAgents
launchctl unload -w homebrew.mxcl.jenkins-lts.plist
launchctl load -w homebrew.mxcl.jenkins-lts.plist
```

むやみやたらに軽い気持ちでアップデートするとPlugin周りの整合性が取れずというところでした。

##参考文献

https://blog.mothule.com/mac/homebrew/mac-homebrew-how-to-downgrade