-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MISC] CI/CD pipelines for image publishing to dockerhub (#1)
- Loading branch information
Showing
5 changed files
with
91 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,30 @@ | ||
name: Build | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Setup LXD | ||
uses: whywaita/setup-lxd@v1 | ||
with: | ||
lxd_version: latest/stable | ||
|
||
- name: Install rockcraft | ||
run: | | ||
sudo snap install --classic --channel edge rockcraft | ||
sudo iptables -F FORWARD | ||
sudo iptables -P FORWARD ACCEPT | ||
- name: Build ROCK | ||
run: sudo rockcraft pack --verbose | ||
|
||
- name: Upload locally built ROCK artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: spark-rock | ||
path: "spark_*.rock" |
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,6 @@ | ||
on: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/build.yaml |
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,10 @@ | ||
on: | ||
push: | ||
branches: | ||
- '*.*/edge' | ||
|
||
jobs: | ||
publish: | ||
name: Publish ROCK | ||
uses: ./.github/workflows/publish.yaml | ||
secrets: inherit |
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,44 @@ | ||
on: | ||
workflow_call: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/build.yaml | ||
publish: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Setup Docker | ||
run: | | ||
sudo snap install docker | ||
sudo addgroup --system docker; sudo adduser $USER docker | ||
newgrp docker | ||
sudo snap disable docker; sudo snap enable docker | ||
- name: Install skopeo | ||
run: | | ||
sudo snap install --devmode --channel edge skopeo | ||
- name: Install yq | ||
run: | | ||
sudo snap install yq | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: spark-rock | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
||
- name: Import and push to Docker Hub | ||
run: | | ||
version="$(cat rockcraft.yaml | yq e '.version')" | ||
sudo skopeo \ | ||
--insecure-policy \ | ||
copy \ | ||
oci-archive:"spark_${version}_amd64.rock" \ | ||
docker-daemon:"dataplatformoci/spark:${version}" | ||
docker push "dataplatformoci/spark:${version}" |
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