Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rpm build for release #1172

Merged
merged 1 commit into from
Sep 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tekton/rpmbuild/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ need to have a PipelineResource for your git repository. See
kubectl create secret generic copr-cli-config --from-file=copr=${HOME}/.config/copr
```

* Make sure you have the GitHUB token set as documented in [RELEASE_PROCESS.md](../../RELEASE_PROCESS.md)

* You should be able create the task with:

```
Expand Down
10 changes: 6 additions & 4 deletions tekton/rpmbuild/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ mkdir -p ${TMPD}
clean() { rm -rf ${TMPD} ;}
trap clean EXIT

set -e
set -ex

curl -o ${TMPD}/output.json -s https://api.github.com/repos/tektoncd/cli/releases/latest
[[ -z ${GITHUB_TOKEN} ]] && { echo "We need a GITHUB_TOKEN".; exit 1;}

curl -H "Authorization: token ${GITHUB_TOKEN}" -o ${TMPD}/output.json -s https://api.github.com/repos/tektoncd/cli/releases/latest
version=$(python3 -c "import sys, json;x=json.load(sys.stdin);print(x['tag_name'])" < ${TMPD}/output.json)
version=${version/v}

Expand All @@ -29,8 +31,8 @@ done

cd ${TMPD}

curl -O -L https://github.com/tektoncd/cli/archive/v${version}.tar.gz
curl -H "Authorization: token ${GITHUB_TOKEN}" -O -L https://github.com/tektoncd/cli/archive/v${version}.tar.gz

rpmbuild -bs tekton.spec --define "_sourcedir $PWD" --define "_srcrpmdir $PWD"

copr-cli --config=/var/secret/copr/copr build tektoncd-cli tektoncd-cli-${version}-1.src.rpm
copr-cli --config=<( echo "${COPR_TOKEN}" ) build tektoncd-cli tektoncd-cli-${version}-1.src.rpm
19 changes: 11 additions & 8 deletions tekton/rpmbuild/rpmbuild-run.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
---
apiVersion: tekton.dev/v1alpha1
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
name: rpmbuild-taskrun
spec:
taskRef:
kind: Task
name: rpmbuild
inputs:
resources:
resources:
inputs:
- name: source
resourceRef:
name: tektoncd-cli-git
params:
- name: copr-cli-secret
value: copr-cli-config
resourceSpec:
type: git
params:
- name: revision
value: master
chmouel marked this conversation as resolved.
Show resolved Hide resolved
- name: url
value: https://github.com/tektoncd/cli
37 changes: 17 additions & 20 deletions tekton/rpmbuild/rpmbuild.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
---
apiVersion: tekton.dev/v1alpha1
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: rpmbuild
spec:
inputs:
params:
- name: copr-cli-secret
description: copr cli secret
default: copr-cli-config
- name: github-token-secret
description: name of the secret holding the github-token
default: github-token
resources:
- name: source
type: git
targetPath: src
resources:
inputs:
- name: source
type: git
targetPath: src
steps:
- name: build-rpm
env:
- name: GITHUB_TOKEN
valueFrom:
secretKeyRef:
name: bot-token-github
key: bot-token
- name: COPR_TOKEN
valueFrom:
secretKeyRef:
name: copr-cli-config
key: copr
image: quay.io/chmouel/rpmbuild
workingdir: /workspace/src
command: ["tekton/rpmbuild/build.sh"]
volumeMounts:
- name: copr-cli-config
mountPath: /var/secret/copr
volumes:
- name: copr-cli-config
secret:
secretName: "$(inputs.params.copr-cli-secret)"