Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature migrate to al2 arm64 #151

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ ssosync
# Noise from os/editors
.DS_Store
*.swp
*/.DS_Store
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ test:
go-build:
go build -o $(APP_NAME) main.go

build-SSOSyncFunction:
GOOS=linux GOARCH=arm64 go build -o bootstrap main.go
cp ./bootstrap $(ARTIFACTS_DIR)/.

.PHONY: clean
clean:
rm -f $(OUTPUT) $(PACKAGED_TEMPLATE)

build-SSOSyncFunction:
GOOS=linux GOARCH=arm64 go build -o bootstrap main.go
cp ./bootstrap $(ARTIFACTS_DIR)/.

.PHONY: install
install:
go get ./...
Expand Down
5 changes: 3 additions & 2 deletions cicd/build/build/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ phases:
# Tweak the .goreleaser.yml so it uses the vairables from .Env
- patch .goreleaser.yml cicd/build/build/goreleaser.patch

# Make main but only for the lambda (linux amd64)
- goreleaser build --snapshot --rm-dist --single-target
# Make main
- goreleaser build --snapshot --clean


# Check we've packaged something useful
Expand All @@ -74,3 +74,4 @@ artifacts:
files:
- ${APP_NAME}
- dist/**/*

23 changes: 18 additions & 5 deletions cicd/build/build/goreleaser.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
--- .goreleaser.yml 2022-06-15 08:38:24.000000000 +0100
+++ .goreleaser-codebuild.yml 2022-06-21 12:33:43.000000000 +0100
@@ -22,7 +22,7 @@
- goos: windows
goarch: 386
--- .goreleaser.yml.default 2023-10-25 11:30:58
+++ .goreleaser.yml 2023-10-25 11:32:18
@@ -9,20 +9,11 @@
- CGO_ENABLED=0
goos:
- linux
- - darwin
- - windows
goarch:
- - 386
- amd64
- - arm
- arm64
- ignore:
- - goos: darwin
- goarch: 386
- - goos: windows
- goarch: 386
ldflags:
- - -s -w -X github.com/awslabs/ssosync/cmd.version={{.Version}} -X github.com/awslabs/ssosync/cmd.commit={{.Commit}} -X github.com/awslabs/ssosync/cmd.date={{.Date}} -X github.com/awslabs/ssosync/cmd.builtBy=goreleaser
+ - -s -w -X github.com/awslabs/ssosync/cmd.version={{.Env.GitTag}} -X github.com/awslabs/ssosync/cmd.commit={{.Env.GitCommit}} -X github.com/awslabs/ssosync/cmd.date={{.Date}} -X github.com/awslabs/ssosync/cmd.builtBy=goreleaser -X github.com/awslabs/ssosync/cmd.goversion={{.Env.GoVersion}}
Expand Down
4 changes: 3 additions & 1 deletion cicd/build/package/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ phases:
# Check that the files need to package exist
- ls README.md
- ls SAR.md
- ls dist/ssosync_linux_amd64_v1/ssosync
- ls dist/ssosync_linux_arm64/ssosync
- ls dist/ssosync_linux_amd64_v1/ssosync

# Check that the executable works
- ./dist/ssosync_linux_amd64_v1/ssosync --version
- mv dist/ssosync_linux_arm64/ssosync bootstrap

build:
commands:
Expand Down
37 changes: 27 additions & 10 deletions cicd/build/package/release.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- template.yaml 2022-11-29 16:56:21.000000000 +0000
+++ release.yaml 2022-11-29 17:11:58.000000000 +0000
--- template.yaml 2023-10-25 09:44:33
+++ release.yaml 2023-10-25 16:02:21
@@ -27,7 +27,7 @@
- IncludeGroups

Expand All @@ -9,29 +9,37 @@
Description: Helping you populate AWS SSO directly with your Google Apps users.
Author: Sebastian Doell
SpdxLicenseId: Apache-2.0
@@ -107,7 +107,7 @@
Ignore these Google Workspace users
@@ -111,7 +111,7 @@
Default: 'none'
IncludeGroups:
Type: String
- Description: |
+ Description: |
Include only these Google Workspace groups. (Only applicable for SyncMethod user_groups)
Default: '*'
SyncMethod:
Type: String
@@ -116,9 +116,9 @@
@@ -121,16 +121,16 @@
AllowedValues:
- groups
- users_groups
-
-
-
+
+
+

-
-
-
Resources:
SSOSyncFunction:
@@ -156,8 +156,6 @@
Type: AWS::Serverless::Function
Properties:
Runtime: provided.al2
- Handler: dist/ssosync_linux_arm64/ssosync
+ Handler: bootstrap
Architectures:
- arm64
Timeout: 300
@@ -163,8 +163,6 @@
- !Ref AWSSCIMAccessTokenSecret
- !Ref AWSRegionSecret
- !Ref AWSIdentityStoreIDSecret
Expand All @@ -40,3 +48,12 @@
- Sid: IdentityStoreAccesPolicy
Effect: Allow
Action:
@@ -187,8 +185,6 @@
Properties:
Enabled: true
Schedule: !Ref ScheduleExpression
- Metadata:
- BuildMethod: makefile

AWSGoogleCredentialsSecret:
Type: "AWS::SecretsManager::Secret"
40 changes: 23 additions & 17 deletions cicd/build/package/staging.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- template.yaml 2022-11-29 16:56:21.000000000 +0000
+++ staging.yaml 2022-11-29 17:10:47.000000000 +0000
--- template.yaml 2023-10-25 09:44:33
+++ staging.yaml 2023-10-25 16:02:07
@@ -27,7 +27,7 @@
- IncludeGroups

Expand All @@ -9,35 +9,38 @@
Description: Helping you populate AWS SSO directly with your Google Apps users.
Author: Sebastian Doell
SpdxLicenseId: Apache-2.0
@@ -107,7 +107,7 @@
Ignore these Google Workspace users
@@ -111,7 +111,7 @@
Default: 'none'
IncludeGroups:
Type: String
- Description: |
+ Description: |
Include only these Google Workspace groups. (Only applicable for SyncMethod user_groups)
Default: '*'
SyncMethod:
Type: String
@@ -116,14 +116,15 @@
@@ -121,16 +121,17 @@
AllowedValues:
- groups
- users_groups
-
-
-
+
+
+

-
-
-
Resources:
SSOSyncFunction:
Type: AWS::Serverless::Function
Properties:
+ FunctionName: SSOSyncFunction
Runtime: go1.x
Handler: dist/ssosync_linux_amd64_v1/ssosync
Runtime: provided.al2
- Handler: dist/ssosync_linux_arm64/ssosync
+ Handler: bootstrap
Architectures:
- arm64
Timeout: 300
@@ -156,8 +157,6 @@
@@ -163,8 +164,6 @@
- !Ref AWSSCIMAccessTokenSecret
- !Ref AWSRegionSecret
- !Ref AWSIdentityStoreIDSecret
Expand All @@ -46,8 +49,8 @@
- Sid: IdentityStoreAccesPolicy
Effect: Allow
Action:
@@ -172,13 +171,13 @@
- "identitystore:DeleteGroupMembership"
@@ -180,16 +179,14 @@
- "identitystore:DeleteGroup"
Resource:
- "*"
- Events:
Expand All @@ -57,17 +60,20 @@
- Properties:
- Enabled: true
- Schedule: !Ref ScheduleExpression
+
- Metadata:
- BuildMethod: makefile

+ - Sid: CodePipelinePolicy
+ Effect: Allow
+ Action:
+ - codepipeline:PutJobSuccessResult
+ - codepipeline:PutJobFailureResult
+ Resource: "*"
+
AWSGoogleCredentialsSecret:
Type: "AWS::SecretsManager::Secret"
@@ -215,3 +214,10 @@
Properties:
@@ -225,3 +222,10 @@
Properties:
Name: SSOSyncIdentityStoreID
SecretString: !Ref IdentityStoreID
Expand Down
2 changes: 1 addition & 1 deletion cicd/cloudformation/developer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ Resources:
Capabilities: CAPABILITY_IAM,CAPABILITY_AUTO_EXPAND
StackName: SmokeTest
RoleArn: !GetAtt [CloudFormationDeployerRole, Arn]
TemplateConfiguration: !Sub 'Tests::deploy/params.json'
TemplateConfiguration: !Sub 'Tests::deploy/developer.json'
TemplatePath: !Sub 'Tests::deploy/stack.yml'
InputArtifacts:
- Name: Tests
Expand Down
10 changes: 9 additions & 1 deletion cicd/staging/build/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,15 @@ phases:
- mkdir deploy
- cp cicd/staging/build/stack.yml ./deploy/

# Update params with the values for this run for the management
# Update params with the values for this run for a developer account
- |
jq -n \
--argjson Parameters "{\"AppArn\": \"$AppArn\", \"AppVersion\": \"$AppVersion\", \"GroupMatch\": \"name:AWS*\"}" \
--argjson StackPolicy "{\"Statement\":[{\"Effect\": \"Allow\", \"NotAction\": \"Update:Delete\", \"Principal\": \"*\", \"Resource\": \"*\"}]}" \
'$ARGS.named' > ./deploy/developer.json
- cat ./deploy/developer.json

# Update params with the values for this run for the management account
- |
jq -n \
--argjson Parameters "{\"AppArn\": \"$AppArn\", \"AppVersion\": \"$AppVersion\", \"GroupMatch\": \"name:Man*\"}" \
Expand Down
2 changes: 1 addition & 1 deletion template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Resources:
Type: AWS::Serverless::Function
Properties:
Runtime: provided.al2
Handler: bootstrap
Handler: dist/ssosync_linux_arm64/ssosync
Architectures:
- arm64
Timeout: 300
Expand Down
Loading