Skip to content

Commit

Permalink
prow: update github-trigger-obs-ci job image by add obs build.script …
Browse files Browse the repository at this point in the history
…support

并且添加treeland.private项目的cijob配置,隐藏构建过程中obs的项目与源码
  • Loading branch information
hudeng-go committed Jul 8, 2024
1 parent a5e9bd5 commit bf379f9
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 1 deletion.
37 changes: 37 additions & 0 deletions services/prow/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -400,3 +400,40 @@ obscijobs:
<param name="versionformat">@CHANGELOG@@DEEPIN_OFFSET@</param>
</service>
</services>
- repos:
- linuxdeepin/treeland.private
project_meta_tpl: |
<project name="vioken:PROJECT_NAME">
<title/>
<description/>
<sourceaccess>
<disable/>
</sourceaccess>
<access>
<disable/>
</access>
<repository name="deepin_ci">
<path project="vioken" repository="deepin_develop"/>
<arch>x86_64</arch>
<arch>aarch64</arch>
</repository>
</project>
package_meta_tpl: |
<package name="PKGNAME" project="deepin:CI:PROJECT_NAME">
<title/>
<description/>
</package>
project_br_tpl: >-
{"action":"opened","pull_request":{"head":{"repo":{"full_name":"REPO"},"sha":"TAGSHA"}}}
project_service_tpl: |
<services>
<service name="obs_gbp">
<param name="url">https://github.com/linuxdeepin/REPO.git</param>
<param name="scm">git</param>
<param name="exclude">.git</param>
<param name="exclude">.github</param>
<param name="versionformat">@CHANGELOG@@DEEPIN_OFFSET@</param>
</service>
</services>
build_script: |
exec dpkg-buildpackage -us -uc --build=any,all "$@"
2 changes: 1 addition & 1 deletion services/prow/config/jobs/images/obsci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN cp /etc/apk/repositories /etc/apk/repositories.bak; \
apk update

RUN apk add py3-pip jq curl; \
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple yq;
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple yq --break-system-packages;


ADD entrypoint.sh /entrypoint.sh
Expand Down
11 changes: 11 additions & 0 deletions services/prow/config/jobs/images/obsci/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ if [ -z "$serviceconfig" ]; then
fi
#echo "serviceconfig: $serviceconfig"

buildscript=$(yq -e '.obscijobs' $yaml_file | yq --arg repo $full_repo_name '.[] as $repos | select($repos.repos[] == $repo) | $repos.build_script')
if [ -z "$buildscript" ]; then
buildscript=$(yq -e '.obscijobs' $yaml_file | yq --arg repo $REPO_OWNER '.[] as $repos | select($repos.repos[] == $repo) | $repos.build_script')
echo "$full_repo_name obs ci build script config isn't existed, using ${REPO_OWNER}'s config"
fi

PROJECT_NAME="$REPO_OWNER:$REPO_NAME:PR-$PULL_NUMBER"
if [[ "$PULL_HEAD_REF" == "topic-"* ]]; then
prefix="topic-"
Expand Down Expand Up @@ -183,6 +189,11 @@ else
curl -X POST -u "$OSCUSER:$OSCPASS" "$OBS_HOST/build/deepin:CI:$PROJECT_NAME?cmd=rebuild&package=$REPO_NAME"
fi

if [ -n "${buildscript}" -o "${buildscript}" != "" -o "${buildscript}" != "null" ]; then
echo ${buildscript} > build.script
curl -X PUT -u "$OSCUSER:$OSCPASS" -d @build.script -s "$OBS_HOST/source/deepin:CI:$PROJECT_NAME/$REPO_NAME/build.script"
fi

echo "Setting github commit status..."
multirepos="true"
repositories=$(cat meta.xml | xq -e '.project.repository[]."@name"')
Expand Down
5 changes: 5 additions & 0 deletions services/prow/config/jobs/submits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ presubmits:
- <<: *github-pr-review-ci
linuxdeepin:
- <<: *github-pr-review-ci
linuxdeepin/treeland.private:
- <<: *github-trigger-obs-ci

postsubmits:
deepin-community:
Expand All @@ -419,3 +421,6 @@ postsubmits:
linuxdeepin:
- <<: *linuxdeepin-sync-to-gitlab
- <<: *linuxdeepin-sync-to-gitee
linuxdeepin/treeland.private:
- <<: *obs-src-sync
- <<: *linuxdeepin-sync-to-gitlab

0 comments on commit bf379f9

Please sign in to comment.