Skip to content

Commit a98ac2a

Browse files
authored
Merge pull request #69 from linuxfoundation/andrest50/fix-ko-build
[LFXV2-1283] fix: fix build errors after committee-service v0.2.22 upgrade and add publish-branch workflow
2 parents cf3cabf + 69bc3c7 commit a98ac2a

5 files changed

Lines changed: 87 additions & 11 deletions

File tree

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Copyright The Linux Foundation and each contributor to LFX.
2+
# SPDX-License-Identifier: MIT
3+
---
4+
name: Publish Container Branch
5+
6+
"on":
7+
pull_request:
8+
branches:
9+
- main
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
publish:
16+
name: Publish Container
17+
if: ${{ github.event.pull_request.head.repo.fork == false }}
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
packages: write
22+
steps:
23+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
24+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
25+
with:
26+
go-version-file: go.mod
27+
- uses: ko-build/setup-ko@d006021bd0c28d1ce33a07e7943d48b079944c8d # v0.9
28+
with:
29+
version: v0.18.0
30+
- name: Prepare container tag
31+
id: container_tag
32+
env:
33+
HEAD_REF: "${{ github.head_ref }}"
34+
run: |
35+
container_tag=$(echo "$HEAD_REF" | sed 's/[^_0-9a-zA-Z]/-/g' | cut -c -127)
36+
echo tag="$container_tag" >> "$GITHUB_OUTPUT"
37+
- name: Build lfx-v1-sync-helper for PR
38+
env:
39+
VERSION: ${{ steps.container_tag.outputs.tag }}
40+
GIT_COMMIT: ${{ github.sha }}
41+
run: |
42+
BUILD_TIME=$(date -u '+%Y-%m-%d_%H:%M:%S')
43+
export BUILD_TIME
44+
GIT_COMMIT=${GIT_COMMIT:0:7}
45+
export GIT_COMMIT
46+
ko build github.com/linuxfoundation/lfx-v1-sync-helper/cmd/lfx-v1-sync-helper \
47+
-B \
48+
--platform linux/amd64,linux/arm64 \
49+
-t ${{ github.sha }} \
50+
-t ${{ steps.container_tag.outputs.tag }} \
51+
--sbom spdx
52+
- name: Build dynamodb-stream-consumer for PR
53+
env:
54+
VERSION: ${{ steps.container_tag.outputs.tag }}
55+
GIT_COMMIT: ${{ github.sha }}
56+
run: |
57+
BUILD_TIME=$(date -u '+%Y-%m-%d_%H:%M:%S')
58+
export BUILD_TIME
59+
GIT_COMMIT=${GIT_COMMIT:0:7}
60+
export GIT_COMMIT
61+
ko build github.com/linuxfoundation/lfx-v1-sync-helper/cmd/dynamodb-stream-consumer \
62+
-B \
63+
--platform linux/amd64,linux/arm64 \
64+
-t ${{ github.sha }} \
65+
-t ${{ steps.container_tag.outputs.tag }} \
66+
--sbom spdx

cmd/lfx-v1-sync-helper/handlers_committees.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ func mapV1DataToCommitteeCreatePayload(ctx context.Context, v1Data map[string]an
412412

413413
// Map governance fields (requires lfx-v2-committee-service >= v0.3.0 with PR #61 merged).
414414
if joinMode, ok := v1Data["join_mode"].(string); ok && joinMode != "" {
415-
payload.JoinMode = &joinMode
415+
payload.JoinMode = joinMode
416416
logger.With("join_mode", joinMode).DebugContext(ctx, "mapped committee join mode field")
417417
}
418418
if mailingListEmail, ok := v1Data["mailing_list_email"].(string); ok && mailingListEmail != "" {
@@ -489,10 +489,7 @@ func mapV1DataToCommitteeUpdateBasePayload(ctx context.Context, committeeUID str
489489
// UpdateCommitteeBasePayload does not support BusinessEmailRequired field.
490490

491491
// Map governance fields (requires lfx-v2-committee-service >= v0.3.0 with PR #61 merged).
492-
if joinMode, ok := v1Data["join_mode"].(string); ok && joinMode != "" {
493-
payload.JoinMode = &joinMode
494-
logger.With("join_mode", joinMode).DebugContext(ctx, "mapped committee join mode field for update")
495-
}
492+
// Note: JoinMode is not available on UpdateCommitteeBasePayload.
496493
if mailingListEmail, ok := v1Data["mailing_list_email"].(string); ok && mailingListEmail != "" {
497494
payload.MailingList = &mailingListEmail
498495
logger.With("mailing_list_email", mailingListEmail).DebugContext(ctx, "mapped committee mailing list email field for update")

cmd/lfx-v1-sync-helper/lfx_v2_client.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,17 @@ func initGoaClients(cfg *Config) error {
215215
committeeHTTPClient.GetCommitteeMember(),
216216
committeeHTTPClient.UpdateCommitteeMember(),
217217
committeeHTTPClient.DeleteCommitteeMember(),
218+
committeeHTTPClient.GetInvite(),
219+
committeeHTTPClient.CreateInvite(),
220+
committeeHTTPClient.RevokeInvite(),
221+
committeeHTTPClient.AcceptInvite(),
222+
committeeHTTPClient.DeclineInvite(),
223+
committeeHTTPClient.GetApplication(),
224+
committeeHTTPClient.SubmitApplication(),
225+
committeeHTTPClient.ApproveApplication(),
226+
committeeHTTPClient.RejectApplication(),
227+
committeeHTTPClient.JoinCommittee(),
228+
committeeHTTPClient.LeaveCommittee(),
218229
)
219230
}
220231

go.mod

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ require (
1515
github.com/aws/aws-sdk-go-v2/service/sts v1.41.6
1616
github.com/golang-jwt/jwt/v5 v5.3.1
1717
github.com/google/uuid v1.6.0
18-
github.com/linuxfoundation/lfx-v2-committee-service v0.2.19
19-
github.com/linuxfoundation/lfx-v2-indexer-service v0.4.14
18+
github.com/linuxfoundation/lfx-v2-committee-service v0.2.22
19+
github.com/linuxfoundation/lfx-v2-indexer-service v0.4.16
2020
github.com/linuxfoundation/lfx-v2-project-service v0.5.6
2121
github.com/nats-io/nats.go v1.48.0
2222
github.com/patrickmn/go-cache v2.1.0+incompatible
@@ -39,7 +39,6 @@ require (
3939
github.com/aws/aws-sdk-go-v2/service/sso v1.30.10 // indirect
4040
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.14 // indirect
4141
github.com/aws/smithy-go v1.24.0 // indirect
42-
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
4342
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
4443
github.com/go-chi/chi/v5 v5.2.5 // indirect
4544
github.com/goccy/go-json v0.10.5 // indirect
@@ -53,7 +52,6 @@ require (
5352
github.com/lestrrat-go/option v1.0.1 // indirect
5453
github.com/nats-io/nkeys v0.4.15 // indirect
5554
github.com/nats-io/nuid v1.0.1 // indirect
56-
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
5755
github.com/segmentio/asm v1.2.1 // indirect
5856
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
5957
go.devnw.com/structs v1.0.0 // indirect

go.sum

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,14 @@ github.com/lestrrat-go/jwx/v2 v2.1.6 h1:hxM1gfDILk/l5ylers6BX/Eq1m/pnxe9NBwW6lVf
7474
github.com/lestrrat-go/jwx/v2 v2.1.6/go.mod h1:Y722kU5r/8mV7fYDifjug0r8FK8mZdw0K0GpJw/l8pU=
7575
github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU=
7676
github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I=
77-
github.com/linuxfoundation/lfx-v2-committee-service v0.2.19 h1:xMeqXvf7NLk9JlfAEpNHBpwFtvtNTnwR/bOjxY/5Fa4=
78-
github.com/linuxfoundation/lfx-v2-committee-service v0.2.19/go.mod h1:vhFiTH/CEDcs2kHmDofKzJclW1ZtBlfaRH0brL6lfek=
77+
github.com/linuxfoundation/lfx-v2-committee-service v0.2.21 h1:UVijQzkz/7VGNC8lVPqgoOG3jqHylbBrl8n7Fx8JTE8=
78+
github.com/linuxfoundation/lfx-v2-committee-service v0.2.21/go.mod h1:zhJDE23mzaiUv1ZACoelN8w9JoUb/Kt9TPuHxU89T9Q=
79+
github.com/linuxfoundation/lfx-v2-committee-service v0.2.22 h1:/zrQGAT4zrRd02BRkpJUWp4Rrx5+ihIptWMiVA1AQ4Y=
80+
github.com/linuxfoundation/lfx-v2-committee-service v0.2.22/go.mod h1:8Jry9qGxz9bMDKrukMK60w4CkElPJC61wm0omZU63Sk=
7981
github.com/linuxfoundation/lfx-v2-indexer-service v0.4.14 h1:GQpAYAjEUNJgg/r4gxGG/teWAAp0eN5+pt/eiM3uaXo=
8082
github.com/linuxfoundation/lfx-v2-indexer-service v0.4.14/go.mod h1:j013GdKST/hMWFhciRuzJd0sy764sNtlmO3gqmsnaCA=
83+
github.com/linuxfoundation/lfx-v2-indexer-service v0.4.16 h1:pOcjVN+KQo2h80je1glL0p69aekwpxmzcTE0VHDwQ/8=
84+
github.com/linuxfoundation/lfx-v2-indexer-service v0.4.16/go.mod h1:hLf2Hl39PsUg2qtl5os0noXxCXWHrkO26EPT+G0RhmA=
8185
github.com/linuxfoundation/lfx-v2-project-service v0.5.6 h1:TvSfGXuI1tZ72eVAc4MbAcn8+evtUhVyvas7W90lPNk=
8286
github.com/linuxfoundation/lfx-v2-project-service v0.5.6/go.mod h1:+CMLc9XBQ4uUUAAa9ioYklcdamVwGkU+DrR+tz/PqZ8=
8387
github.com/nats-io/nats.go v1.48.0 h1:pSFyXApG+yWU/TgbKCjmm5K4wrHu86231/w84qRVR+U=

0 commit comments

Comments
 (0)