-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Nathan Klick <[email protected]>
- Loading branch information
1 parent
9ca292f
commit fa16c15
Showing
3 changed files
with
99 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,11 @@ on: | |
description: "Version Policy:" | ||
type: string | ||
required: true | ||
# Valid registry names are as follows: gcp, jfrog | ||
registry-name: | ||
description: "Registry Name (gcp or jfrog):" | ||
type: string | ||
required: true | ||
dry-run-enabled: | ||
description: "Perform Dry Run" | ||
type: boolean | ||
|
@@ -25,6 +30,21 @@ on: | |
docker-image: | ||
description: "Docker Image:" | ||
value: ${{ jobs.publish-image.outputs.docker-image }} | ||
docker-image-prefix: | ||
description: "Docker Image Prefix:" | ||
value: ${{ jobs.publish-image.outputs.docker-image-prefix }} | ||
docker-image-tag: | ||
description: "Docker Image Tag:" | ||
value: ${{ jobs.publish-image.outputs.docker-image-tag }} | ||
secrets: | ||
jf-url: | ||
required: true | ||
jf-user-name: | ||
required: true | ||
jf-docker-registry: | ||
required: true | ||
jf-access-token: | ||
required: true | ||
|
||
defaults: | ||
run: | ||
|
@@ -43,6 +63,8 @@ jobs: | |
runs-on: [self-hosted, Linux, large, ephemeral] | ||
outputs: | ||
docker-image: ${{ steps.set-registry.outputs.docker-tag-base }}/consensus-node:${{ inputs.version }} | ||
docker-image-prefix: ${{ steps.set-registry.outputs.docker-tag-base }} | ||
docker-image-tag: ${{ inputs.version }} | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
|
@@ -57,12 +79,27 @@ jobs: | |
- name: Authenticate to Google Cloud | ||
id: google-auth | ||
uses: google-github-actions/auth@55bd3a7c6e2ae7cf1877fd1ccb9d54c0503c457c # v2.1.2 | ||
if: ${{ inputs.dry-run-enabled != true && !cancelled() && !failure() }} | ||
if: ${{ inputs.dry-run-enabled != true && inputs.registry-name == 'gcp' && !cancelled() && !failure() }} | ||
with: | ||
token_format: 'access_token' | ||
workload_identity_provider: "projects/235822363393/locations/global/workloadIdentityPools/hedera-builds-pool/providers/hedera-builds-gh-actions" | ||
service_account: "[email protected]" | ||
|
||
- name: Setup JFrog CLI | ||
uses: jfrog/setup-jfrog-cli@d82fe26823e1f25529250895d5673f65b02af085 # v4.0.1 | ||
if: ${{ inputs.dry-run-enabled != true && inputs.registry-name == 'jfrog' && !cancelled() && !failure() }} | ||
env: | ||
JF_URL: ${{ secrets.jf-url }} | ||
JF_ACCESS_TOKEN: ${{ secrets.jf-access-token }} | ||
|
||
- name: Show JFrog Config | ||
if: ${{ inputs.dry-run-enabled != true && inputs.registry-name == 'jfrog' && !cancelled() && !failure() }} | ||
run: jfrog config show | ||
|
||
- name: Verify JFrog Connectivity | ||
if: ${{ inputs.dry-run-enabled != true && inputs.registry-name == 'jfrog' && !cancelled() && !failure() }} | ||
run: jfrog rt ping | ||
|
||
- name: Commit Information | ||
id: commit | ||
run: | | ||
|
@@ -72,12 +109,16 @@ jobs: | |
id: set-registry | ||
run: | | ||
DOCKER_REGISTRY="gcr.io" | ||
[[ "${{ inputs.version-policy }}" == "branch-commit" ]] && DOCKER_REGISTRY="us-docker.pkg.dev" | ||
[[ "${{ inputs.version-policy }}" == "branch-commit" && "${{ inputs.registry-name }}" == "gcp" ]] && DOCKER_REGISTRY="us-docker.pkg.dev" | ||
[[ "${{ inputs.registry-name }}" == "jfrog" ]] && DOCKER_REGISTRY="artifacts.swirldslabs.io" | ||
echo "docker-registry=${DOCKER_REGISTRY}" >>"${GITHUB_OUTPUT}" | ||
DOCKER_TAG_BASE="gcr.io/hedera-registry" | ||
[[ "${{ inputs.registry-name }}" == "jfrog" ]] && DOCKER_TAG_BASE="artifacts.swirldslabs.io/consensus-node-docker-release" | ||
if [[ "${{ inputs.version-policy }}" == "branch-commit" && "${{ inputs.dry-run-enabled }}" != true ]]; then | ||
DOCKER_TAG_BASE="us-docker.pkg.dev/swirlds-registry/docker-adhoc-commits" | ||
[[ "${{ inputs.registry-name }}" == "gcp" ]] && DOCKER_TAG_BASE="us-docker.pkg.dev/swirlds-registry/docker-adhoc-commits" | ||
[[ "${{ inputs.registry-name }}" == "jfrog" ]] && DOCKER_TAG_BASE="artifacts.swirldslabs.io/consensus-node-docker-dev" | ||
elif [[ "${{ inputs.dry-run-enabled }}" == true ]]; then | ||
DOCKER_TAG_BASE="localhost:5000" | ||
fi | ||
|
@@ -141,14 +182,22 @@ jobs: | |
if: ${{ inputs.dry-run-enabled == true && !cancelled() && !failure() }} | ||
run: docker run -d -p 5000:5000 --restart=always --name registry registry:latest | ||
|
||
- name: Docker Login | ||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | ||
if: ${{ inputs.dry-run-enabled != true && !cancelled() && !failure() }} | ||
- name: Docker Login (GCP) | ||
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 | ||
if: ${{ inputs.dry-run-enabled != true && inputs.registry-name == 'gcp' && !cancelled() && !failure() }} | ||
with: | ||
registry: ${{ steps.set-registry.outputs.docker-registry }} | ||
username: oauth2accesstoken | ||
password: ${{ steps.google-auth.outputs.access_token }} | ||
|
||
- name: Docker Login (JFrog) | ||
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 | ||
if: ${{ inputs.dry-run-enabled != true && inputs.registry-name == 'jfrog' && !cancelled() && !failure() }} | ||
with: | ||
registry: ${{ steps.set-registry.outputs.docker-registry }} | ||
username: ${{ secrets.jf-user-name }} | ||
password: ${{ secrets.jf-access-token }} | ||
|
||
- name: Stage SDK Artifacts | ||
run: | | ||
mkdir -p hedera-node/infrastructure/docker/containers/production-next/consensus-node/sdk | ||
|
@@ -173,6 +222,12 @@ jobs: | |
if [[ "${{ inputs.dry-run-enabled }}" != true ]]; then | ||
CONSENSUS_NODE_LINK="[GCP Console](https://${{ steps.set-registry.outputs.docker-tag-base }}/consensus-node:${{ inputs.version }})" | ||
if [[ "${{ inputs.registry-name }}" == "jfrog" ]]; then | ||
if [[ "${{ inputs.version-policy }}" == "branch-commit" ]]; then | ||
CONSENSUS_NODE_LINK="[Artifactory](https://artifacts.swirldslabs.io/ui/native/consensus-node-docker-dev)" | ||
else | ||
CONSENSUS_NODE_LINK="[Artifactory](https://artifacts.swirldslabs.io/ui/native/consensus-node-docker-release)" | ||
fi | ||
fi | ||
printf "### Published Docker Images\n" >> "${GITHUB_STEP_SUMMARY}" | ||
|