Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

fix: update for sar role #49

Merged
merged 6 commits into from
Sep 24, 2023
Merged
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
5 changes: 1 addition & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ on:
branches:
- main

env:
UTILS_VERSION: 0.2.1

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
Expand Down Expand Up @@ -42,7 +39,7 @@ jobs:
repository: tiki/core-iceberg-utils
token: ${{ github.token }}
path: utils
ref: ${{ env.UTILS_VERSION }}
ref: ${{ vars.UTILS_VERSION }}

- name: Maven Install Utils
run: cd utils && mvn clean package install
Expand Down
29 changes: 13 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ on:
types:
- closed

env:
SESSION_NAME : "gh_action"
AWS_REGION : "us-east-2"
UTILS_VERSION: 0.2.1

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
Expand All @@ -26,8 +21,10 @@ jobs:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: SetVars
run: |
sed -i 's/${AWS::AccountId}/${{ secrets.AWS_ACCOUNT_ID }}/' infra/role/template.yml

- name: Set up JDK
uses: actions/setup-java@v3
Expand All @@ -41,7 +38,7 @@ jobs:
repository: tiki/core-iceberg-utils
token: ${{ github.token }}
path: utils
ref: ${{ env.UTILS_VERSION }}
ref: ${{ vars.UTILS_VERSION }}

- name: Maven Install Utils
run: cd utils && mvn clean package install
Expand All @@ -52,22 +49,22 @@ jobs:
- name: AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::254962200554:role/GitHubDeployBase
role-session-name: ${{ env.SESSION_NAME }}
aws-region: ${{ env.AWS_REGION }}
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/GitHubDeployBase
role-session-name: ${{ vars.SESSION_NAME }}
aws-region: ${{ vars.AWS_REGION }}

- name: SAM Deploy GitHub
run: cd infra/github && sam build && sam package && sam deploy
run: cd infra/role && sam build && sam package && sam deploy

- name: AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::254962200554:role/GitHubDeployIcebergMetadata
role-session-name: ${{ env.SESSION_NAME }}
aws-region: ${{ env.AWS_REGION }}
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/GitHubDeployCoreIcebergMetadata
role-session-name: ${{ vars.SESSION_NAME }}
aws-region: ${{ vars.AWS_REGION }}

- name: SAM Publish
run: cd infra/aws && sam build && sam package --output-template-file packaged.yaml && sam publish --template packaged.yaml
run: cd infra/sar && sam build && sam package --output-template-file packaged.yaml && sam publish --template packaged.yaml

- name: Get Version
id: version
Expand Down
16 changes: 3 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ on:
branches:
- main

env:
UTILS_VERSION: 0.2.1

# Cancel any active builds when new commits are pushed
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
Expand Down Expand Up @@ -37,7 +33,7 @@ jobs:
repository: tiki/core-iceberg-utils
token: ${{ github.token }}
path: utils
ref: ${{ env.UTILS_VERSION }}
ref: ${{ vars.UTILS_VERSION }}

- name: Maven Install Utils
run: cd utils && mvn clean package install
Expand All @@ -53,13 +49,7 @@ jobs:
path: target/surefire-reports/**/*.xml

- name: Validate AWS Template
run: cd infra/aws && sam validate
run: cd infra/sar && sam validate

- name: Build AWS Template
run: cd infra/aws && sam build

- name: Validate GitHub Template
run: cd infra/github && sam validate

- name: Build GitHub Template
run: cd infra/github && sam build
run: cd infra/sar && sam build
3 changes: 2 additions & 1 deletion .github/workflows/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:

- name: Update SAR Version
run: |
sed -i 's/SemanticVersion: .*/SemanticVersion: ${{ steps.semver.outputs.nextStrict }}/' infra/aws/template.yaml
sed -i 's/SemanticVersion: .*/SemanticVersion: ${{ steps.semver.outputs.nextStrict }}/' infra/sar/template.yml
- name: Commit Changes
continue-on-error: true
Expand All @@ -53,6 +53,7 @@ jobs:
git config --global user.email "[email protected]"
git config --global user.name "GH Action"
git add pom.xml
git add infra/sar/template.yml
git commit -m 'version bump'
git push
Expand Down
22 changes: 0 additions & 22 deletions infra/github/policy.yml

This file was deleted.

67 changes: 0 additions & 67 deletions infra/github/role.yml

This file was deleted.

26 changes: 0 additions & 26 deletions infra/github/template.yml

This file was deleted.

4 changes: 2 additions & 2 deletions infra/github/samconfig.toml → infra/role/samconfig.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version = 0.1

[default.global.parameters]
stack_name = "core-iceberg-metadata-github"
stack_name = "core-iceberg-metadata-role"
s3_bucket = "mytiki-sam-deploy"
s3_prefix = "core/iceberg/metadata/github"
s3_prefix = "core/iceberg/metadata/role"
region = "us-east-2"

[default.deploy.parameters]
Expand Down
46 changes: 46 additions & 0 deletions infra/role/template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Core Iceberg Metadata Role

Parameters:
RoleName:
Description: Name of the IAM Role for the deployment
Type: String
Default: "GitHubDeployCoreIcebergMetadata"

Resources:
Role:
Type: AWS::Serverless::Application
Properties:
Location:
ApplicationId: arn:aws:serverlessrepo:us-east-2:${AWS::AccountId}:applications/core-aws-github-role
SemanticVersion: 0.0.3
Parameters:
GitHubOrg: tiki
RepositoryName: core-iceberg-metadata
RoleName: !Ref RoleName

Policy:
Type: AWS::IAM::RolePolicy
DependsOn: Role
Properties:
RoleName: !Ref RoleName
PolicyName: DeploymentPolicy
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- serverlessrepo:ListApplications
- serverlessrepo:CreateApplication
- serverlessrepo:SearchApplications
Resource: "*"
- Effect: Allow
Action:
- serverlessrepo:*
Resource: !Sub arn:aws:serverlessrepo:${AWS::Region}:${AWS::AccountId}:applications/core-iceberg-metadata
- Effect: Allow
Action:
- s3:PutObject
- s3:GetObject
Resource: !Sub arn:aws:s3:::mytiki-sam-deploy/*
4 changes: 2 additions & 2 deletions infra/aws/samconfig.toml → infra/sar/samconfig.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version = 0.1

[default.global.parameters]
stack_name = "core-iceberg-metadata-aws"
stack_name = "core-iceberg-metadata-sar"
s3_bucket = "mytiki-sam-deploy"
s3_prefix = "core/iceberg/metadata/aws"
s3_prefix = "core/iceberg/metadata/sar"
region = "us-east-2"

[default.deploy.parameters]
Expand Down
4 changes: 2 additions & 2 deletions infra/aws/template.yml → infra/sar/template.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Iceberg Metadata
Description: Core Iceberg Metadata SAR

Parameters:
QueueName:
Expand Down Expand Up @@ -30,7 +30,7 @@ Metadata:
ReadmeUrl: ../../README.md
Labels: ['iceberg']
HomePageUrl: https://github.com/tiki/core-iceberg-metadata
SemanticVersion: 0.1.2
SemanticVersion: 0.1.4
SourceCodeUrl: https://github.com/tiki/core-iceberg-metadata

Resources:
Expand Down
8 changes: 2 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,21 @@
-->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.mytiki</groupId>
<artifactId>core-iceberg-metadata</artifactId>
<version>0.1.2</version>
<version>0.1.4</version>
<packaging>jar</packaging>
<name>Iceberg Metadata</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>com.mytiki</groupId>
<artifactId>core-iceberg-utils</artifactId>
<version>0.2.1</version>
<version>0.2.2</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -38,7 +35,6 @@
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
Expand Down