Skip to content

Commit 316d1d0

Browse files
committed
1 parent e1bfd01 commit 316d1d0

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

template.go

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ func writeTemplates(dir, gopkg, debsrc, debLib, debProg, debversion string,
4343
if err := writeDebianPackageInstall(dir, debLib, debProg, pkgType); err != nil {
4444
return err
4545
}
46+
if err := writeDebianGitLabCI(dir); err != nil {
47+
return err
48+
}
4649
return nil
4750
}
4851

@@ -358,3 +361,44 @@ func writeDebianPackageInstall(dir, debLib, debProg string, pkgType packageType)
358361
}
359362
return nil
360363
}
364+
365+
func writeDebianGitLabCI(dir string) error {
366+
const gitlabciymlTmpl = `# auto-generated, DO NOT MODIFY.
367+
# The authoritative copy of this file lives at:
368+
# https://salsa.debian.org/go-team/ci/blob/master/config/gitlabciyml.go
369+
370+
# TODO: publish under debian-go-team/ci
371+
image: stapelberg/ci2
372+
373+
test_the_archive:
374+
artifacts:
375+
paths:
376+
- before-applying-commit.json
377+
- after-applying-commit.json
378+
script:
379+
# Create an overlay to discard writes to /srv/gopath/src after the build:
380+
- "rm -rf /cache/overlay/{upper,work}"
381+
- "mkdir -p /cache/overlay/{upper,work}"
382+
- "mount -t overlay overlay -o lowerdir=/srv/gopath/src,upperdir=/cache/overlay/upper,workdir=/cache/overlay/work /srv/gopath/src"
383+
- "export GOPATH=/srv/gopath"
384+
- "export GOCACHE=/cache/go"
385+
# Build the world as-is:
386+
- "ci-build -exemptions=/var/lib/ci-build/exemptions.json > before-applying-commit.json"
387+
# Copy this package into the overlay:
388+
- "GBP_CONF_FILES=:debian/gbp.conf gbp buildpackage --git-no-pristine-tar --git-ignore-branch --git-ignore-new --git-export-dir=/tmp/export --git-no-overlay --git-tarball-dir=/nonexistant --git-cleaner=/bin/true --git-builder='dpkg-buildpackage -S -d --no-sign'"
389+
- "pgt-gopath -dsc /tmp/export/*.dsc"
390+
# Rebuild the world:
391+
- "ci-build -exemptions=/var/lib/ci-build/exemptions.json > after-applying-commit.json"
392+
- "ci-diff before-applying-commit.json after-applying-commit.json"
393+
`
394+
395+
f, err := os.Create(filepath.Join(dir, "debian", "gitlab-ci.yml"))
396+
if err != nil {
397+
return err
398+
}
399+
defer f.Close()
400+
401+
fmt.Fprintf(f, gitlabciymlTmpl)
402+
403+
return nil
404+
}

0 commit comments

Comments
 (0)