Skip to content

Commit

Permalink
feat: add commercial package support
Browse files Browse the repository at this point in the history
借助obs的项目隐藏功能和build.script实现商业项目的源码不可见需求

备注: 1. integration.yml添加gitaddr字段,在商业组件集成过程中添加这个字段指定需要该组件的git ssh源码地址,obs服务通过ssh拉去源码
      2. 商业组件目前不支持自动获取changelog,集成单需要自行备注
  • Loading branch information
hudeng-go committed Jul 8, 2024
1 parent 66d2a7c commit 1b55392
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 2 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/01-parsec-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
build_matrix_community:
description: build tasks
value: ${{ jobs.parsec_integration.outputs.build_matrix_community }}
build_matrix_commercial:
description: build tasks
value: ${{ jobs.parsec_integration.outputs.build_matrix_commercial }}
all_build_task:
description: all build tasks used for
value: ${{ jobs.parsec_integration.outputs.all_build_task }}
Expand Down Expand Up @@ -48,6 +51,7 @@ jobs:
build_matrix_main: ${{ steps.parsec_integration.outputs.build_matrix_main }}
build_matrix_dde: ${{ steps.parsec_integration.outputs.build_matrix_dde }}
build_matrix_community: ${{ steps.parsec_integration.outputs.build_matrix_community }}
build_matrix_commercial: ${{ steps.parsec_integration.outputs.build_matrix_commercial }}
all_build_task: ${{ steps.parsec_integration.outputs.all_build_task }}
testrepoaddr: ${{ steps.parsec_integration.outputs.testrepoaddr }}
deploy: ${{ steps.illegal_repo_tags.outputs.DEPLOY }}
Expand All @@ -72,6 +76,7 @@ jobs:
GITHUB_TOKEN: ${{ github.token }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
COMMERCIALS: ${{ vars.COMMERCIALS }}
run: |
import requests
import yaml
Expand Down Expand Up @@ -172,7 +177,10 @@ jobs:
def get_component(repo):
print("get component")
commercials = os.environ.get("COMMERCIALS")
commercial_list = commercials.split(",")
component = "main"
package = repo[repo.find('/')+1:]
if "linuxdeepin/" in repo:
component = "dde"
else:
Expand All @@ -184,10 +192,13 @@ jobs:
else:
print("Warn: get workflows.yml content failed!!!")
component = "community"
if package in commercial_list:
component = "commercial"
return component
try:
components = ["main", "dde", "community"]
components = ["main", "dde", "community", "commercial"]
allBuildTasks = [{"component": j,"data":{"payload": []}} for j in components]
data = read_integration()
Expand All @@ -211,6 +222,8 @@ jobs:
component_index = 1
if component == "community":
component_index = 2
if component == "commercial":
component_index = 3
print("component: %s" % component)
tagsha = repo.get('tagsha', "")
tag = repo.get('tag', "")
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/02-build-obs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ on:
component:
type: string
default: "main"
gitaddr:
type: string
workflow_dispatch:
inputs:
repo:
Expand All @@ -40,6 +42,7 @@ env:
TAGSHA: ${{ inputs.tagsha }}
GITHUB_TOKEN: ${{ github.token }}
OSCPASS: ${{ secrets.OSCPASS }}
GITADDR: ${{ inputs.gitaddr }}

jobs:
build:
Expand Down Expand Up @@ -80,6 +83,10 @@ jobs:
curl -o meta1.xml https://raw.githubusercontent.com/deepin-community/Repository-Integration/master/.github/workflows/obs-proj-component-meta.tpl
sed -i "s#TOPIC#${TOPIC}#g" meta1.xml
sed -i "s#COMPONENT#${COMPONENT}#g" meta1.xml
if [ "$COMPONENT" = "commercial" ]; then
echo "commercail project, disable access!!!"
sed -i '4a \ \ <sourceaccess>\n\ \ \ \ <disable/>\n\ \ </sourceaccess>\n\ \ <access>\n\ \ \ \ <disable/>\n\ \ </access>' meta1.xml
fi
curl -X PUT -u golf66:$OSCPASS -H "Content-type: text/xml" -d @meta1.xml "https://build.deepin.com/source/deepin:CI:TestingIntegration:$TOPIC:$COMPONENT/_meta"
fi
fi
Expand Down Expand Up @@ -157,6 +164,14 @@ jobs:
if [ ! -f _service ];then
curl -o _service https://raw.githubusercontent.com/deepin-community/Repository-Integration/master/.github/workflows/obs-pkg.tpl && \
sed -i "s#REPO#$REPO#g" _service
if [ "$COMPONENT" = "commercial" ]; then
echo "commercial package, need use private git ssh address!!!"
new_content=" <param name=\"url\">${GITADDR}</param>"
sed -i "3c ${new_content}" _service
echo "commercial package, disable build source!!!"
echo "exec dpkg-buildpackage -us -uc --build=any,all \"\$@\"" > build.script
curl -X PUT -u golf66:$OSCPASS -d @build.script -s "$uploadurl/build.script"
fi
curl -X PUT -u golf66:$OSCPASS -d @_service -s "$uploadurl/_service"
fi
if [ $needbuild = "true" ];then
Expand Down
25 changes: 24 additions & 1 deletion .github/workflows/auto-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,14 @@ jobs:
- build_main
- build_dde
- build_community
- build_commercial
if: |
always() && !cancelled() &&
(needs.parsec_integration.result == 'success') && (needs.ouput_message.result != 'failure' ) &&
(needs.build_main.result == 'success' || needs.build_main.result == 'skipped') &&
(needs.build_dde.result == 'success' || needs.build_dde.result == 'skipped') &&
(needs.build_community.result == 'success' || needs.build_community.result == 'skipped')
(needs.build_community.result == 'success' || needs.build_community.result == 'skipped') &&
(needs.build_commercial.result == 'success' || needs.build_commercial.result == 'skipped')
steps:
- name: wait build pending status
uses: actions/github-script@v6
Expand Down Expand Up @@ -172,13 +174,15 @@ jobs:
- build_main
- build_dde
- build_community
- build_commercial
- wait_build_pending_status
if: |
always() && !cancelled() &&
(needs.parsec_integration.result == 'success') && (needs.ouput_message.result != 'failure' ) &&
(needs.build_main.result == 'success' || needs.build_main.result == 'skipped') &&
(needs.build_dde.result == 'success' || needs.build_dde.result == 'skipped') &&
(needs.build_community.result == 'success' || needs.build_community.result == 'skipped') &&
(needs.build_commercial.result == 'success' || needs.build_commercial.result == 'skipped') &&
needs.wait_build_pending_status.result == 'success'
uses: deepin-community/Repository-Integration/.github/workflows/issue-project-manager.yml@master
secrets: inherit
Expand Down Expand Up @@ -279,3 +283,22 @@ jobs:
tagsha: ${{ matrix.payload.tagsha }}
topic: test-integration-pr-${{ github.event.number }}
component: "community"

build_commercial:
name: build_commercial
if: always() && !cancelled() && (needs.parsec_integration.outputs.build_matrix_commercial != '') && (needs.parsec_integration.result == 'success')
needs:
- parsec_integration
- build_project_prepare
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.parsec_integration.outputs.build_matrix_commercial) }}
uses: deepin-community/Repository-Integration/.github/workflows/02-build-obs.yml@master
secrets: inherit
with:
repo: ${{ matrix.payload.repo }}
tag: ${{ matrix.payload.tag }}
tagsha: ${{ matrix.payload.tagsha }}
topic: test-integration-pr-${{ github.event.number }}
component: "commercial"
gitaddr: ${{ matrix.payload.gitaddr }}

0 comments on commit 1b55392

Please sign in to comment.