Skip to content

Commit

Permalink
chore(build): split testing and snapshot image build (#3739)
Browse files Browse the repository at this point in the history
  • Loading branch information
chillleader authored Dec 3, 2024
1 parent c4bbfc2 commit f6e7f5c
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 26 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/BUILD_FEATURE_BRANCH.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Build branch for preview env deployment

on:
push:
branches:
- '**'
- '!main'

jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Import Secrets
id: secrets
uses: hashicorp/[email protected]
with:
url: ${{ secrets.VAULT_ADDR }}
method: approle
roleId: ${{ secrets.VAULT_ROLE_ID }}
secretId: ${{ secrets.VAULT_SECRET_ID }}
exportEnv: false # we rely on step outputs, no need for environment variables
secrets: |
secret/data/products/connectors/ci/common ARTIFACTORY_USR | CI_LDAP_USER;
secret/data/products/connectors/ci/common ARTIFACTORY_PSW | CI_LDAP_PASSWORD;
- name: Restore cache
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'

# Use CI Nexus as co-located pull-through cache for Maven artifacts via ~/.m2/settings.xml
- name: 'Create settings.xml'
uses: s4u/[email protected]
with:
githubServer: false
servers: |
[{
"id": "camunda-nexus",
"username": "${{ steps.secrets.outputs.CI_LDAP_USER }}",
"password": "${{ steps.secrets.outputs.CI_LDAP_PASSWORD }}"
}]
mirrors: '[{"url": "https://repository.nexus.camunda.cloud/content/groups/internal/", "id": "camunda-nexus", "mirrorOf": "camunda-nexus", "name": "camunda Nexus"}]'

- uses: actions/setup-node@v4
with:
node-version: '16'

- name: Install element templates CLI
run: npm install --global element-templates-cli

- name: Package Connectors
env:
PROJECTS: bundle/default-bundle
run: mvn --batch-mode compile generate-sources package -DskipTests --projects "${PROJECTS}" --also-make

- name: Set up Docker Build
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: registry.camunda.cloud
username: ${{ steps.secrets.outputs.CI_LDAP_USER }}
password: ${{ steps.secrets.outputs.CI_LDAP_PASSWORD }}

# Publish Docker images for Preview environments
- name: Build and Push Docker Image tag ${{ env.TAG }} - bundle-default
env:
TAG: pr-${{ github.sha }}
uses: docker/build-push-action@v6
with:
context: bundle/default-bundle/
provenance: false
push: true
tags: registry.camunda.cloud/team-connectors/connectors-bundle:${{ env.TAG }}
26 changes: 0 additions & 26 deletions .github/workflows/TEST_FEATURE_BRANCH.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,29 +77,3 @@ jobs:
uses: hadolint/[email protected]
with:
dockerfile: bundle/default-bundle/Dockerfile

- name: Package Connectors
env:
PROJECTS: bundle/default-bundle
run: mvn --batch-mode compile generate-sources package -DskipTests --projects "${PROJECTS}" --also-make

- name: Set up Docker Build
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: registry.camunda.cloud
username: ${{ steps.secrets.outputs.CI_LDAP_USER }}
password: ${{ steps.secrets.outputs.CI_LDAP_PASSWORD }}

# Publish Docker images for Preview environments
- name: Build and Push Docker Image tag ${{ env.TAG }} - bundle-default
env:
TAG: pr-${{ github.sha }}
uses: docker/build-push-action@v6
with:
context: bundle/default-bundle/
provenance: false
push: true
tags: registry.camunda.cloud/team-connectors/connectors-bundle:${{ env.TAG }}

0 comments on commit f6e7f5c

Please sign in to comment.