-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1836 from kbase/trussimage
DATAUP-128: First pass at adding support for a Truss tagged image build, based on branch named "truss"
- Loading branch information
Showing
5 changed files
with
88 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
name: Build Truss Branch Image | ||
'on': | ||
pull_request: | ||
branches: | ||
- truss | ||
types: | ||
- opened | ||
- synchronize | ||
- ready_for_review | ||
jobs: | ||
docker_build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out GitHub Repo | ||
if: github.event.pull_request.draft == false | ||
with: | ||
ref: "${{ github.event.pull_request.head.sha }}" | ||
uses: actions/checkout@v2 | ||
- name: Build and Push to Packages | ||
if: github.event.pull_request.draft == false | ||
env: | ||
PR: "${{ github.event.pull_request.number }}" | ||
SHA: "${{ github.event.pull_request.head.sha }}" | ||
DOCKER_ACTOR: "jsfillman" | ||
DOCKER_TOKEN: "${{ secrets.GHCR_TOKEN }}" | ||
run: "./.github/workflows/scripts/build_truss_pr.sh\n" |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#! /usr/bin/env bash | ||
|
||
export MY_ORG=$(echo "${GITHUB_REPOSITORY}" | awk -F / '{print $1}') | ||
export MY_APP=$(echo $(echo "${GITHUB_REPOSITORY}" | awk -F / '{print $2}')"-truss") | ||
export DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | ||
export BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | ||
export COMMIT=$(echo "$SHA" | cut -c -7) | ||
|
||
echo $DOCKER_TOKEN | docker login ghcr.io -u $DOCKER_ACTOR --password-stdin | ||
docker build --build-arg BUILD_DATE="$DATE" \ | ||
--build-arg COMMIT="$COMMIT" \ | ||
--build-arg BRANCH="$GITHUB_HEAD_REF" \ | ||
--build-arg PULL_REQUEST="$PR" \ | ||
--label us.kbase.vcs-pull-req="$PR" \ | ||
-t ghcr.io/"$MY_ORG"/"$MY_APP":"pr-""$PR" . | ||
docker push ghcr.io/"$MY_ORG"/"$MY_APP":"pr-""$PR" | ||
|
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#! /usr/bin/env bash | ||
|
||
export MY_ORG=$(echo "${GITHUB_REPOSITORY}" | awk -F / '{print $1}') | ||
export MY_APP=$(echo $(echo "${GITHUB_REPOSITORY}" | awk -F / '{print $2}')"-truss") | ||
export DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | ||
export BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | ||
export COMMIT=$(echo "$SHA" | cut -c -7) | ||
|
||
docker login -u "$DOCKER_ACTOR" -p "$DOCKER_TOKEN" ghcr.io | ||
docker pull ghcr.io/"$MY_ORG"/"$MY_APP":"pr-""$PR" | ||
docker tag ghcr.io/"$MY_ORG"/"$MY_APP":"pr-""$PR" ghcr.io/"$MY_ORG"/"$MY_APP":"latest" | ||
docker push ghcr.io/"$MY_ORG"/"$MY_APP":"latest" |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
name: Tag Latest Test Image | ||
'on': | ||
pull_request: | ||
branches: | ||
- truss | ||
types: | ||
- closed | ||
jobs: | ||
docker_tag: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out GitHub Repo | ||
if: github.event_name == 'pull_request' && github.event.action == 'closed' && | ||
github.event.pull_request.merged == true | ||
with: | ||
ref: "${{ github.event.pull_request.head.sha }}" | ||
uses: actions/checkout@v2 | ||
- name: Build and Push to Packages | ||
if: github.event.pull_request.draft == false | ||
env: | ||
PR: "${{ github.event.pull_request.number }}" | ||
SHA: "${{ github.event.pull_request.head.sha }}" | ||
DOCKER_ACTOR: "jsfillman" | ||
DOCKER_TOKEN: "${{ secrets.GHCR_TOKEN }}" | ||
run: "./.github/workflows/scripts/tag_truss_latest.sh\n" |
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