Skip to content

Instantly share code, notes, and snippets.

View makotom's full-sized avatar
👋
Huomiseen. Bye.

Makoto Mizukami makotom

👋
Huomiseen. Bye.
View GitHub Profile
@makotom
makotom / run.js
Created February 5, 2021 10:13
Generate per-minute histogram from timestamps
const fs = require('fs');
function countTimestamps(timestamps) {
const ret = new Map();
timestamps.forEach((timestamp) => {
ret.set(timestamp, (ret.get(timestamp) || 0) + 1);
});
return ret;
@makotom
makotom / sad-buildkit.md
Last active November 11, 2020 23:52
`registry-mirrors` は HTTPS でないと BuildKit が動作しないが治るらしい

registry-mirrors は HTTPS でないと BuildKit が動作しないが治るらしい

Docker の GitHub Issues のやりとりにいろいろ矛盾があるので, これはもしかして誰も気づいていないだけでいろいろぶっ壊れたままなのでは? と思って調べてみたら, どうやら 20.10 ですべて治るというのだけは本当らしい. 眠気が収まらない間片手間にやった調べものなので内容は不正確かもしれない.

Docker 19.03.13 でのはなし

@makotom
makotom / procJobs.js
Created June 2, 2020 02:25
CircleCI Server: Process list of jobs and users, and extract a list of unseen users
// Modules to use
const fs = require('fs');
{
// Output: Array of users unseen in the job list
const unseenUsers = [];
// Output: Tab-separated list of jobs
const jobsTSV = [];
// Source data
package main
import "fmt"
type greeting struct {}
func (* greeting) sayHello() string {
return "Hello world!"
}
@makotom
makotom / lifecycle-policy-example.md
Last active July 27, 2020 07:11
CircleCI Server: Example of lifecycle policy for S3

Example of lifecycle policy configuration on a S3 bucket used by CircleCI

Prefix Tag Days Description of files Side effects of deletion
artifacts (null) 30 General artifacts (deliverables from store_artifacts and store_test_results) Artifacts will disappear from the list of artifacts in job results. URLs will return 404.
artifacts "circleci.object_type" === "project.cache" 15 Dependency caches The first build after deletion will be slow due to cache miss.
artifacts "circleci.object_type" === "workflow.workspace" 15 Workspaces If a job depending on workspaces is rerun (e.g. SSH rerun), attach_workspace will restore no files, and subsequent steps will fail.
artifacts/picard-task-configs (null) 1 Task config Nothing especially.
action-logs (null) 365 Outputs from each step Outputs will not be shown any more. Loading indicator will not disappear after opening a pull-down for each step.
cache (null
@makotom
makotom / lifecycle-policy-example.md
Last active July 27, 2020 07:09
CircleCI Server: ライフサイクル ポリシーの設定例

ライフサイクル ポリシーの設定例

摘要 プレフィクス タグ 日数 削除した場合の影響
Artifacts 一般 (store_artifactsstore_test_results の生データ) artifacts (なし) 30 Artifacts は一覧に表示されなくなります。 URL を直接開いた場合、 404 エラーとなります。
依存関係キャッシュ artifacts "circleci.object_type" === "project.cache" 15 キャッシュ ミスが発生した場合、削除後初回のビルドは低速になります。
ワークスペース artifacts "circleci.object_type" === "workflow.workspace" 15 SSH ビルドなどにより、ワークスペースをアタッチするジョブのみを単体で再実行した場合、 attach_workspace でワークスペースが展開されず、後続のステップでエラーが発生する場合があります。
task config artifacts/picard-task-configs (なし) 1 特にございません。
各ステップの実行ログ action-logs (なし) 365 過去に実行したジョブの出力は表示されなくなります。 Web UI 上で該当するジョブの出力を表示しようとすると、ロード中の表示のままになります。
現在使用されていないキャッシュ cache (なし) 15 仮に当該フォルダーにあるキャッシュを使用するビルドがあった場合、削除後初回のビルドが低速になります。
@makotom
makotom / main.go
Created May 2, 2020 11:02
Convert config.yml into JSON
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
yaml "github.com/notnoopci/yaml"
)
{
"jobs": {
"build": {
"docker": [
{
"image": "archlinux:latest"
}
],
"steps": [
{
package main
import (
"fmt"
"bytes"
"os/exec"
"syscall"
)
func main() {
@makotom
makotom / main.go
Created March 30, 2020 05:24
Go and "No-Go"
package main
import (
"fmt"
"bytes"
"os/exec"
)
func main() {
var out bytes.Buffer