Skip to content

Commit

Permalink
Merge pull request #292 from splitio/INFRA-8251-1
Browse files Browse the repository at this point in the history
Restore S3 workflow
  • Loading branch information
Israphel authored Nov 25, 2024
2 parents 03b79ed + 652d5d3 commit 18466bc
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 19 deletions.
31 changes: 22 additions & 9 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,31 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Dockerhub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_RO_TOKEN }}

- name: Login to Artifactory
if: ${{ github.event_name == 'push' }}
uses: docker/login-action@v3
with:
registry: splitio-docker.jfrog.io
username: ${{ secrets.ARTIFACTORY_DOCKER_USER }}
registry: ${{ vars.ARTIFACTORY_DOCKER_REGISTRY }}
username: ${{ vars.ARTIFACTORY_DOCKER_USER }}
password: ${{ secrets.ARTIFACTORY_DOCKER_PASS }}

- name: Get version
run: echo "VERSION=$(awk '/^const Version/{gsub(/"/, "", $4); print $4}' splitio/version.go)" >> $GITHUB_ENV

- name: Docker Build and Push
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile.${{ matrix.app }}
push: ${{ github.event_name == 'push' }}
platforms: linux/amd64,linux/arm64
tags: splitio-docker.jfrog.io/split-${{ matrix.app }}${{ matrix.fips_mode == 'enabled' && '-fips' || ''}}:${{ env.VERSION }},splitio-docker.jfrog.io/split-${{ matrix.app }}${{ matrix.fips_mode == 'enabled' && '-fips' || '' }}:latest
tags: ${{ vars.ARTIFACTORY_DOCKER_REGISTRY }}/split-${{ matrix.app }}${{ matrix.fips_mode == 'enabled' && '-fips' || ''}}:${{ env.VERSION }},${{ vars.ARTIFACTORY_DOCKER_REGISTRY }}/split-${{ matrix.app }}${{ matrix.fips_mode == 'enabled' && '-fips' || '' }}:latest
build-args: |
FIPS_MODE=${{ matrix.fips_mode }}
Expand All @@ -77,21 +83,28 @@ jobs:
- name: Get version
run: echo "VERSION=$(awk '/^const Version/{gsub(/"/, "", $4); print $4}' splitio/version.go)" >> $GITHUB_ENV

- name: Login to Dockerhub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_RO_TOKEN }}

- name: Docker Build and Push
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile.${{ matrix.app }}
push: false
tags: splitio-docker.jfrog.io/split-${{ matrix.app }}${{ matrix.fips_mode == 'enabled' && '-fips' || ''}}:${{ env.VERSION }}
tags: ${{ vars.ARTIFACTORY_DOCKER_REGISTRY }}/split-${{ matrix.app }}${{ matrix.fips_mode == 'enabled' && '-fips' || ''}}:${{ env.VERSION }}
build-args: |
FIPS_MODE=${{ matrix.fips_mode }}
- name: Scan container using Lacework
uses: lacework/[email protected].1
uses: lacework/[email protected].3
with:
LW_ACCOUNT_NAME: ${{ secrets.LW_ACCOUNT_NAME }}
LW_ACCOUNT_NAME: ${{ vars.LW_ACCOUNT_NAME }}
LW_ACCESS_TOKEN: ${{ secrets.LW_ACCESS_TOKEN }}
IMAGE_NAME: splitio-docker.jfrog.io/split-${{ matrix.app }}${{ matrix.fips_mode == 'enabled' && '-fips' || ''}}
IMAGE_NAME: ${{ vars.ARTIFACTORY_DOCKER_REGISTRY }}/split-${{ matrix.app }}${{ matrix.fips_mode == 'enabled' && '-fips' || ''}}
IMAGE_TAG: ${{ env.VERSION }}
SAVE_RESULTS_IN_LACEWORK: true
RESULTS_IN_GITHUB_SUMMARY: true
48 changes: 48 additions & 0 deletions .github/workflows/s3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: cd

on:
push:
branches:
- master
pull_request:
branches:
- master

permissions:
contents: read
id-token: write

jobs:
build-publish:
name: Build and publish to S3
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23.3'

- name: Create build folder
run: mkdir -p build

- name: Execute build
run: make release_assets

- name: Configure AWS credentials
if: ${{ github.event_name == 'push' }}
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::825951051969:role/gha-downloads-role
aws-region: us-east-1

- name: Deploy to S3
if: ${{ github.event_name == 'push' }}
run: aws s3 sync $SOURCE_DIR s3://$BUCKET
env:
BUCKET: downloads.split.io
SOURCE_DIR: ./build
28 changes: 20 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: test

on:
push:
branches:
- master
pull_request:
branches-ignore:
- none
Expand All @@ -12,6 +15,9 @@ jobs:
services:
redis:
image: redis
credentials:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_RO_TOKEN }}
ports:
- 6379:6379
steps:
Expand All @@ -23,22 +29,17 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '^1.23.3'
go-version: '1.23.3'

- name: Get version
run: echo "VERSION=$(awk '/^const Version/{gsub(/"/, "", $4); print $4}' splitio/version.go)" >> $GITHUB_ENV

- name: Run test
run: make test_coverage

- name: Create build folder
run: mkdir -p build

- name: Build assets
run: make release_assets

- name: SonarQube Scan (Pull Request)
uses: SonarSource/sonarcloud-github-action@v2
if: ${{ github.event_name == 'pull_request' }}
uses: SonarSource/sonarcloud-github-action@v3
env:
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
with:
Expand All @@ -49,3 +50,14 @@ jobs:
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
-Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }}
-Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }}
- name: SonarQube Scan (Push)
if: ${{ github.event_name == 'push' }}
uses: SonarSource/sonarcloud-github-action@v3
env:
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
with:
projectBaseDir: .
args: >
-Dsonar.host.url=${{ vars.SONARQUBE_HOST }}
-Dsonar.projectVersion=${{ env.VERSION }}
10 changes: 8 additions & 2 deletions .github/workflows/unstable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,24 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Dockerhub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_RO_TOKEN }}

- name: Login to Artifactory
uses: docker/login-action@v3
with:
registry: splitio-docker-dev.jfrog.io
username: ${{ secrets.ARTIFACTORY_DOCKER_USER }}
username: ${{ vars.ARTIFACTORY_DOCKER_USER }}
password: ${{ secrets.ARTIFACTORY_DOCKER_PASS }}

- name: Get short hash
run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV

- name: Docker Build and Push
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile.${{ matrix.app }}
Expand Down

0 comments on commit 18466bc

Please sign in to comment.