Skip to content

Commit 4d5115b

Browse files
authored
Merge pull request #445 from slashdevops/fix-httpclient
fix: http client and sync
2 parents c415e54 + 5cac7de commit 4d5115b

File tree

25 files changed

+304
-177
lines changed

25 files changed

+304
-177
lines changed

.github/workflows/aws-sam.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ jobs:
4343

4444
steps:
4545
- name: Check out code
46-
uses: actions/checkout@v4
46+
uses: actions/checkout@v5
4747

4848
- name: Set up Go 1.x
4949
id: go
50-
uses: actions/setup-go@v5
50+
uses: actions/setup-go@v6
5151
with:
5252
go-version-file: ./go.mod
5353

.github/workflows/build.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ jobs:
2323
MAKE_DEBUG: "true"
2424
steps:
2525
- name: Check out code
26-
uses: actions/checkout@v4
26+
uses: actions/checkout@v5
2727

2828
- name: Set up Go 1.x
2929
id: go
30-
uses: actions/setup-go@v5
30+
uses: actions/setup-go@v6
3131
with:
3232
go-version-file: ./go.mod
3333

@@ -41,7 +41,6 @@ jobs:
4141
- name: codecov coverage report
4242
uses: codecov/codecov-action@v5
4343
with:
44-
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
4544
files: ./coverage.out
4645

4746
- name: Build

.github/workflows/codeql.yml

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ name: "CodeQL Advanced"
1313

1414
on:
1515
push:
16-
branches: [ "main" ]
16+
branches: ["main"]
1717
pull_request:
18-
branches: [ "main" ]
18+
branches: ["main"]
1919
schedule:
20-
- cron: '44 0 * * 5'
20+
- cron: "44 0 * * 5"
2121

2222
jobs:
2323
analyze:
@@ -43,10 +43,10 @@ jobs:
4343
fail-fast: false
4444
matrix:
4545
include:
46-
- language: actions
47-
build-mode: none
48-
- language: go
49-
build-mode: autobuild
46+
- language: actions
47+
build-mode: none
48+
- language: go
49+
build-mode: autobuild
5050
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
5151
# Use `c-cpp` to analyze code written in C, C++ or both
5252
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
@@ -56,45 +56,45 @@ jobs:
5656
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
5757
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
5858
steps:
59-
- name: Checkout repository
60-
uses: actions/checkout@v4
59+
- name: Checkout repository
60+
uses: actions/checkout@v5
6161

62-
# Add any setup steps before running the `github/codeql-action/init` action.
63-
# This includes steps like installing compilers or runtimes (`actions/setup-node`
64-
# or others). This is typically only required for manual builds.
65-
# - name: Setup runtime (example)
66-
# uses: actions/setup-example@v1
62+
# Add any setup steps before running the `github/codeql-action/init` action.
63+
# This includes steps like installing compilers or runtimes (`actions/setup-node`
64+
# or others). This is typically only required for manual builds.
65+
# - name: Setup runtime (example)
66+
# uses: actions/setup-example@v1
6767

68-
# Initializes the CodeQL tools for scanning.
69-
- name: Initialize CodeQL
70-
uses: github/codeql-action/init@v3
71-
with:
72-
languages: ${{ matrix.language }}
73-
build-mode: ${{ matrix.build-mode }}
74-
# If you wish to specify custom queries, you can do so here or in a config file.
75-
# By default, queries listed here will override any specified in a config file.
76-
# Prefix the list here with "+" to use these queries and those in the config file.
68+
# Initializes the CodeQL tools for scanning.
69+
- name: Initialize CodeQL
70+
uses: github/codeql-action/init@v3
71+
with:
72+
languages: ${{ matrix.language }}
73+
build-mode: ${{ matrix.build-mode }}
74+
# If you wish to specify custom queries, you can do so here or in a config file.
75+
# By default, queries listed here will override any specified in a config file.
76+
# Prefix the list here with "+" to use these queries and those in the config file.
7777

78-
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
79-
# queries: security-extended,security-and-quality
78+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
79+
# queries: security-extended,security-and-quality
8080

81-
# If the analyze step fails for one of the languages you are analyzing with
82-
# "We were unable to automatically build your code", modify the matrix above
83-
# to set the build mode to "manual" for that language. Then modify this step
84-
# to build your code.
85-
# ℹ️ Command-line programs to run using the OS shell.
86-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
87-
- if: matrix.build-mode == 'manual'
88-
shell: bash
89-
run: |
90-
echo 'If you are using a "manual" build mode for one or more of the' \
91-
'languages you are analyzing, replace this with the commands to build' \
92-
'your code, for example:'
93-
echo ' make bootstrap'
94-
echo ' make release'
95-
exit 1
81+
# If the analyze step fails for one of the languages you are analyzing with
82+
# "We were unable to automatically build your code", modify the matrix above
83+
# to set the build mode to "manual" for that language. Then modify this step
84+
# to build your code.
85+
# ℹ️ Command-line programs to run using the OS shell.
86+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
87+
- if: matrix.build-mode == 'manual'
88+
shell: bash
89+
run: |
90+
echo 'If you are using a "manual" build mode for one or more of the' \
91+
'languages you are analyzing, replace this with the commands to build' \
92+
'your code, for example:'
93+
echo ' make bootstrap'
94+
echo ' make release'
95+
exit 1
9696
97-
- name: Perform CodeQL Analysis
98-
uses: github/codeql-action/analyze@v3
99-
with:
100-
category: "/language:${{matrix.language}}"
97+
- name: Perform CodeQL Analysis
98+
uses: github/codeql-action/analyze@v3
99+
with:
100+
category: "/language:${{matrix.language}}"

.github/workflows/container-image.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ jobs:
2828
runs-on: ubuntu-latest
2929
steps:
3030
- name: Check out code
31-
uses: actions/checkout@v4
31+
uses: actions/checkout@v5
3232

3333
- name: Set up Go 1.x
3434
id: go
35-
uses: actions/setup-go@v5
35+
uses: actions/setup-go@v6
3636
with:
3737
go-version-file: ./go.mod
3838

.github/workflows/release.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ jobs:
2222
runs-on: ubuntu-latest
2323
steps:
2424
- name: Check out code
25-
uses: actions/checkout@v4
25+
uses: actions/checkout@v5
2626

2727
- name: Set up Go 1.x
2828
id: go
29-
uses: actions/setup-go@v5
29+
uses: actions/setup-go@v6
3030
with:
3131
go-version-file: ./go.mod
3232

@@ -43,11 +43,11 @@ jobs:
4343
runs-on: ubuntu-latest
4444
steps:
4545
- name: Check out code
46-
uses: actions/checkout@v4
46+
uses: actions/checkout@v5
4747

4848
- name: Set up Go 1.x
4949
id: go
50-
uses: actions/setup-go@v5
50+
uses: actions/setup-go@v6
5151
with:
5252
go-version-file: ./go.mod
5353

@@ -75,11 +75,11 @@ jobs:
7575
runs-on: ubuntu-latest
7676
steps:
7777
- name: Check out code
78-
uses: actions/checkout@v4
78+
uses: actions/checkout@v5
7979

8080
- name: Set up Go 1.x
8181
id: go
82-
uses: actions/setup-go@v5
82+
uses: actions/setup-go@v6
8383
with:
8484
go-version-file: ./go.mod
8585

@@ -96,7 +96,7 @@ jobs:
9696
echo ${{ github.ref_name }}
9797
9898
- name: Download Distribution files
99-
uses: actions/download-artifact@v4
99+
uses: actions/download-artifact@v5
100100
with:
101101
name: dist
102102
path: ./dist/

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,7 @@ dist/
3333

3434
*.log
3535

36-
credentials.json
36+
credentials.json
37+
run.sh
38+
idpscim
39+
idpscimcli

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"cmpopts",
1313
"codecov",
1414
"codeql",
15+
"cogu",
1516
"curesp",
1617
"Datahub",
1718
"Debugf",
@@ -55,9 +56,11 @@
5556
"lastsync",
5657
"liberapay",
5758
"logrus",
59+
"mailcom",
5860
"mapstructure",
5961
"mbrs",
6062
"mjack",
63+
"mockgen",
6164
"mydomain",
6265
"Optns",
6366
"patreon",
@@ -67,6 +70,7 @@
6770
"retryablehttp",
6871
"SCIM",
6972
"scimid",
73+
"SCIMJSON",
7074
"secretmanager",
7175
"securego",
7276
"sirupsen",

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ require (
1010
github.com/aws/aws-sdk-go-v2/service/s3 v1.88.1
1111
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.39.4
1212
github.com/google/go-cmp v0.7.0
13+
github.com/hashicorp/go-retryablehttp v0.7.8
1314
github.com/p2p-b2b/httpretrier v0.0.3
1415
github.com/pkg/errors v0.9.1
1516
github.com/spf13/cobra v1.10.1
@@ -50,6 +51,7 @@ require (
5051
github.com/google/uuid v1.6.0 // indirect
5152
github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect
5253
github.com/googleapis/gax-go/v2 v2.15.0 // indirect
54+
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
5355
github.com/inconshreveable/mousetrap v1.1.0 // indirect
5456
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
5557
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect

go.sum

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ github.com/aws/smithy-go v1.23.0/go.mod h1:t1ufH5HMublsJYulve2RKmHDC15xu1f26kHCp
4747
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
4848
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
4949
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
50+
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
51+
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
5052
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
5153
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
5254
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
@@ -72,12 +74,22 @@ github.com/googleapis/enterprise-certificate-proxy v0.3.6 h1:GW/XbdyBFQ8Qe+YAmFU
7274
github.com/googleapis/enterprise-certificate-proxy v0.3.6/go.mod h1:MkHOF77EYAE7qfSuSS9PU6g4Nt4e11cnsDUowfwewLA=
7375
github.com/googleapis/gax-go/v2 v2.15.0 h1:SyjDc1mGgZU5LncH8gimWo9lW1DtIfPibOG81vgd/bo=
7476
github.com/googleapis/gax-go/v2 v2.15.0/go.mod h1:zVVkkxAQHa1RQpg9z2AUCMnKhi0Qld9rcmyfL1OZhoc=
77+
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
78+
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
79+
github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k=
80+
github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
81+
github.com/hashicorp/go-retryablehttp v0.7.8 h1:ylXZWnqa7Lhqpk0L1P1LzDtGcCR0rPVUrx/c8Unxc48=
82+
github.com/hashicorp/go-retryablehttp v0.7.8/go.mod h1:rjiScheydd+CxvumBsIrFKlx3iS0jrZ7LvzFGFmuKbw=
7583
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
7684
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
7785
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
7886
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
7987
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
8088
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
89+
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
90+
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
91+
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
92+
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
8193
github.com/p2p-b2b/httpretrier v0.0.3 h1:6Udp+5zuzgBZ6Hu5Es4/dKWHv8pzRSvXCHXRjYJTgNU=
8294
github.com/p2p-b2b/httpretrier v0.0.3/go.mod h1:J/aV00SornLs70X/DY3B4IPkDjICynXLfA/TWpAlErw=
8395
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=

internal/core/actions.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@ func scimSync(
8484
"idp", idpGroupsMembersResult.Items,
8585
"scim", scimGroupsMembersResult.Items,
8686
)
87-
membersCreate, membersEqual, membersDelete, err := model.MembersOperations(idpGroupsMembersResult, scimGroupsMembersResult)
87+
88+
// Update the IDP group members with SCIM IDs from the created/updated groups and users
89+
groupsMembers := model.UpdateGroupsMembersSCIMID(idpGroupsMembersResult, totalGroupsResult, totalUsersResult)
90+
91+
membersCreate, membersEqual, membersDelete, err := model.MembersOperations(groupsMembers, scimGroupsMembersResult)
8892
if err != nil {
8993
return nil, nil, nil, fmt.Errorf("error reconciling groups members: %w", err)
9094
}

0 commit comments

Comments
 (0)