blob: c1eaf25cd2823c9323746c7650aad08297a2fd75 [file] [log] [blame]
Paul Sokolovsky555aef52024-03-17 15:40:15 +07001- job:
2 name: tf-a-lts-create-release
3 node: docker-amd64-tf-a-jammy
4 project-type: freestyle
5 concurrent: false
6 disabled: false
7 description: Create a new TF-A LTS release from a tip of an LTS branch.
8 properties:
9 - build-discarder:
10 days-to-keep: 365
11 num-to-keep: 30
Paul Sokolovsky555aef52024-03-17 15:40:15 +070012 parameters:
13 - string:
14 name: GERRIT_HOST
15 default: 'review.trustedfirmware.org'
16 - string:
17 name: GERRIT_PROJECT
Paul Sokolovsky69eda932024-03-19 17:55:32 +070018 default: 'TF-A/trusted-firmware-a'
Paul Sokolovsky555aef52024-03-17 15:40:15 +070019 description: |
20 TF-A Git project
21 - string:
22 name: GERRIT_BRANCH
23 default: 'lts-v2.10'
24 description: |
25 Git branch to release from (lts-v2.8, lts-v2.10, etc.)
26 - bool:
27 name: SANDBOX_RUN
28 default: true
29 description: |
Paul Sokolovskyec961f52024-03-17 23:21:44 +070030 Run sandbox simulation of a release. A tag will be created in
31 separate "sandbox" namespace, and further actions like docs
32 publishing or release email sending will be also sandboxed.
33 Uncheck this only after running a simulation and verifying that
34 everything is correct!
Paul Sokolovsky555aef52024-03-17 15:40:15 +070035 wrappers:
36 - credentials-binding:
37 - ssh-user-private-key:
38 credential-id: TFA_CI_BOT_USER_SSH_KEY
39 key-file-variable: CI_BOT_KEY
40 username-variable: CI_BOT_USERNAME
41 passphrase-variable: ''
42 - timestamps
43 builders:
44 - shell: |
45 #!/bin/bash
46 set -ex
47 env | grep GERRIT
48 echo SANDBOX_RUN=$SANDBOX_RUN
49 git clone https://git.trustedfirmware.org/ci/tf-a-ci-scripts.git
50 git clone https://$GERRIT_HOST/$GERRIT_PROJECT
51 DIR=$(basename $GERRIT_PROJECT)
52 cd $DIR
53 git checkout $GERRIT_BRANCH
54 set +x
55 nvm install
56 set -x
57 npm install --no-save standard-version
58 #git tag
59
60 echo "" >> readme.rst
61 git config user.email "ci@trustedfirmware.org"
62 git config user.name "Release CI"
63 # Install Change-Id hook
64 f="$(git rev-parse --git-dir)/hooks/commit-msg"; curl -o "$f" https://review.trustedfirmware.org/tools/hooks/commit-msg ; chmod +x "$f"
65
66 if [ "$SANDBOX_RUN" == "true" ]; then
Paul Sokolovsky7979b442024-03-18 21:29:18 +070067 git commit -a -s -m "fix(readme): dummy commit for sandbox release"
Paul Sokolovsky555aef52024-03-17 15:40:15 +070068 fi
69
70 python3 $WORKSPACE/tf-a-ci-scripts/lts/lts-mangle-change-log.py remove-prefix docs/change-log.md >docs/change-log.md.tmp
71 mv docs/change-log.md.tmp docs/change-log.md
72 npm run release -- --release-as patch --tag-prefix lts-v
73 python3 $WORKSPACE/tf-a-ci-scripts/lts/lts-mangle-change-log.py add-prefix docs/change-log.md >docs/change-log.md.tmp
74 mv docs/change-log.md.tmp docs/change-log.md
75
76 RELEASE=$(grep release docs/conf.py | sed -r -e 's/release = "(.*)"/\1/')
77
78 git diff
Paul Sokolovsky7979b442024-03-18 21:29:18 +070079 git commit -a -s -m "docs(changelog): changelog for lts-v${RELEASE} release"
Paul Sokolovsky555aef52024-03-17 15:40:15 +070080 if [ "$SANDBOX_RUN" == "true" ]; then
81 TAG="sandbox/lts-v${RELEASE}-$(date +%Y%m%dT%H%M)"
82 else
83 TAG="lts-v${RELEASE}"
84 fi
85 git tag $TAG
86
87 mkdir -p ~/.ssh/
88 ssh-keyscan -p 29418 $GERRIT_HOST >> ~/.ssh/known_hosts
89 export GIT_SSH_COMMAND="ssh -i $CI_BOT_KEY -o 'PubkeyAcceptedKeyTypes +ssh-rsa'"
90
91 #git push ssh://$CI_BOT_USERNAME@$GERRIT_HOST:29418/$GERRIT_PROJECT HEAD:refs/for/$GERRIT_BRANCH
92
Paul Sokolovsky555aef52024-03-17 15:40:15 +070093 if [ "$SANDBOX_RUN" == "false" ]; then
Paul Sokolovskyb6d08532024-03-19 19:01:46 +070094 # Push to the LTS branch
Paul Sokolovsky555aef52024-03-17 15:40:15 +070095 git push ssh://$CI_BOT_USERNAME@$GERRIT_HOST:29418/$GERRIT_PROJECT
Paul Sokolovskyb6d08532024-03-19 19:01:46 +070096 else
97 # If it's sandbox run, we still need to push commit to some branch,
98 # because otherwise the tag won't be visible in Gerrit (due to ACL
99 # model Gerrit uses: it resolve tag to a branch it belongs to, then
100 # checks ACLs on branch to see if a user has access to it; no branch
101 # == problems).
102 git push ssh://${CI_BOT_USERNAME}@${GERRIT_HOST}:29418/${GERRIT_PROJECT} HEAD:refs/heads/${TAG}-br
Paul Sokolovsky555aef52024-03-17 15:40:15 +0700103 fi
104 # Push tag
105 git push ssh://$CI_BOT_USERNAME@$GERRIT_HOST:29418/$GERRIT_PROJECT $TAG
106
Saheer Babua9f45032024-12-19 00:41:23 +0000107 echo Release tag is created. Further processing happens in the job ${JENKINS_PUBLIC_URL}job/tf-a-lts-release-tagged