generated from ydataai/go-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pipelines): ecr integration (#5)
- Loading branch information
Showing
4 changed files
with
75 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
name: Merge master | ||
|
||
|
||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
|
||
|
||
jobs: | ||
prepare: | ||
name: Calculate Version and Build Number | ||
|
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 |
---|---|---|
@@ -1,17 +1,25 @@ | ||
name: Prereleased | ||
|
||
|
||
|
||
on: | ||
release: | ||
types: | ||
- prereleased | ||
|
||
|
||
|
||
env: | ||
COMPONENT: authentication-service | ||
COMPONENT_PATH: apps/authentication-service | ||
COMPONENT_PATH: contrib | ||
|
||
PRIVATE_ECR_ACCESSKEYID: ${{ secrets.AWS_ECR_ACCESSKEYID }} | ||
PRIVATE_ECR_SECRETACCESSKEY: ${{ secrets.AWS_ECR_SECRETACCESSKEY }} | ||
PRIVATE_ECR_REGION: ${{ secrets.AWS_ECR_REGION }} | ||
|
||
CONTAINER: authentication-service-container-image | ||
DOCKER_REPOSITORY: authentication-service | ||
|
||
CONTAINER: container_image | ||
DOCKER_IMAGE_URL: ${{ secrets.PRIVATE_CONTAINER_REGISTRY }}/${{ github.repository_owner }}/authentication-service | ||
|
||
|
||
jobs: | ||
|
@@ -53,22 +61,25 @@ jobs: | |
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: docker/login-action@v1 | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
registry: ${{ secrets.PRIVATE_CONTAINER_REGISTRY }} | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GHCR_TOKEN }} | ||
aws-access-key-id: ${{ env.PRIVATE_ECR_ACCESSKEYID }} | ||
aws-secret-access-key: ${{ env.PRIVATE_ECR_SECRETACCESSKEY }} | ||
aws-region: ${{ env.PRIVATE_ECR_REGION }} | ||
|
||
- uses: docker/setup-buildx-action@v1 | ||
- name: Login to Amazon ECR | ||
id: ecr_password | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
- uses: docker/build-push-action@v2 | ||
id: docker_build | ||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
env: | ||
DOCKER_IMAGE_TAG: ${{ steps.ecr_password.outputs.registry }}/${{ env.DOCKER_REPOSITORY }}:${{ needs.prepare.outputs.version }} | ||
with: | ||
file: Dockerfile | ||
context: . | ||
push: true | ||
tags: ${{ env.DOCKER_IMAGE_URL }}:${{ needs.prepare.outputs.version }} | ||
secrets: | | ||
GIT_AUTH_TOKEN=${{ secrets.GHCR_TOKEN }} | ||
tags: ${{ env.DOCKER_IMAGE_TAG }} | ||
|
||
|
||
update-manifests: | ||
|
@@ -94,14 +105,14 @@ jobs: | |
env: | ||
VERSION: ${{ needs.prepare.outputs.version }} | ||
run: | | ||
cd ${COMPONENT_PATH} | ||
kustomize edit set image ${CONTAINER}=${DOCKER_IMAGE_URL}:${VERSION} | ||
cd ${COMPONENT_PATH}/ | ||
kustomize edit set image ${CONTAINER}=${DOCKER_REPOSITORY}:${VERSION} | ||
- name: Commit and push image update into manifests repo | ||
env: | ||
VERSION: ${{ needs.prepare.outputs.version }} | ||
run: | | ||
git config user.email "[email protected]" | ||
git config user.name "Azory YData Bot" | ||
git commit -a -m "chore(bump): [CI] [DEV] bump ${COMPONENT} to $VERSION" | ||
git commit -a -m "chore(bump): [CI] [DEV] bump ${{ env.COMPONENT }} to $VERSION" | ||
git push origin master |
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 |
---|---|---|
@@ -1,10 +1,14 @@ | ||
name: Pull request | ||
|
||
|
||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
|
||
|
||
jobs: | ||
build: | ||
name: Build | ||
|
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 |
---|---|---|
@@ -1,24 +1,47 @@ | ||
name: Released | ||
|
||
|
||
|
||
on: | ||
release: | ||
types: | ||
- released | ||
|
||
|
||
|
||
env: | ||
COMPONENT: authentication-service | ||
COMPONENT_PATH: apps/authentication-service | ||
COMPONENT_PATH: contrib | ||
|
||
PRIVATE_ECR_ACCESSKEYID: ${{ secrets.AWS_ECR_ACCESSKEYID }} | ||
PRIVATE_ECR_SECRETACCESSKEY: ${{ secrets.AWS_ECR_SECRETACCESSKEY }} | ||
PRIVATE_ECR_REGION: ${{ secrets.AWS_ECR_REGION }} | ||
|
||
CONTAINER: authentication-service-container-image | ||
DOCKER_REPOSITORY: authentication-service | ||
|
||
CONTAINER: container_image | ||
DOCKER_IMAGE_URL: ${{ secrets.PRIVATE_CONTAINER_REGISTRY }}/${{ github.repository_owner }}/authentication-service | ||
|
||
|
||
jobs: | ||
cancel_previous: | ||
name: 'Cancel Previous Runs' | ||
runs-on: ubuntu-20.04 | ||
timeout-minutes: 3 | ||
|
||
steps: | ||
- uses: ydataai/[email protected] | ||
with: | ||
ignore_sha: true | ||
access_token: ${{ secrets.ACCESS_TOKEN }} | ||
|
||
|
||
prepare: | ||
name: Extract Version and Build number | ||
name: Prepare | ||
runs-on: ubuntu-20.04 | ||
|
||
needs: | ||
- cancel_previous | ||
|
||
outputs: | ||
build_number: ${{ steps.short_sha.outputs.value }} | ||
version: ${{ steps.version.outputs.value }} | ||
|
@@ -43,17 +66,21 @@ jobs: | |
- prepare | ||
|
||
steps: | ||
- name: Login to GitHub docker | ||
uses: docker/login-action@v1 | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
registry: ${{ secrets.PRIVATE_CONTAINER_REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GHCR_TOKEN }} | ||
aws-access-key-id: ${{ env.PRIVATE_ECR_ACCESSKEYID }} | ||
aws-secret-access-key: ${{ env.PRIVATE_ECR_SECRETACCESSKEY }} | ||
aws-region: ${{ env.PRIVATE_ECR_REGION }} | ||
|
||
- name: Login to Amazon ECR | ||
id: ecr_password | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
- name: Docker tag and push | ||
env: | ||
SOURCE: ${{ env.DOCKER_IMAGE_URL }}:${{ needs.prepare.outputs.version }}.${{ needs.prepare.outputs.build_number }} | ||
DESTINATION: ${{ env.DOCKER_IMAGE_URL }}:${{ needs.prepare.outputs.version }} | ||
SOURCE: ${{ steps.ecr_password.outputs.registry }}/${{ env.DOCKER_REPOSITORY }}:${{ needs.prepare.outputs.version }}.${{ needs.prepare.outputs.build_number }} | ||
DESTINATION: ${{ steps.ecr_password.outputs.registry }}/${{ env.DOCKER_REPOSITORY }}:${{ needs.prepare.outputs.version }} | ||
run: | | ||
docker pull $SOURCE | ||
docker tag $SOURCE $DESTINATION | ||
|
@@ -83,8 +110,8 @@ jobs: | |
env: | ||
VERSION: ${{ needs.prepare.outputs.version }} | ||
run: | | ||
cd ${COMPONENT_PATH} | ||
kustomize edit set image ${CONTAINER}=${DOCKER_IMAGE_URL}:${VERSION} | ||
cd ${COMPONENT_PATH}/ | ||
kustomize edit set image ${CONTAINER}=${DOCKER_REPOSITORY}:${VERSION} | ||
- name: Commit and push image update into manifests repo | ||
env: | ||
|