-
Notifications
You must be signed in to change notification settings - Fork 101
124 lines (106 loc) · 5.71 KB
/
manual-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Manual Operator Build Dispatch
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to Build From'
required: true
tag:
description: 'Additional tag for the build (such as alpha, beta, etc.) - Optional'
default: ''
jobs:
publish-image:
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.branch }}
- uses: actions/setup-go@v3
with:
go-version: "1.19"
- name: Get Current Date
id: date
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
- name: Prepare Suffix
id: suffix
if: ${{ github.event.inputs.tag != '' }}
run: echo suffix="-${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
- name: Prepare Tags
id: prep
run: |
DOCKER_OPERATOR_IMAGE=noobaa/noobaa-operator
DOCKER_OPERATOR_BUNDLE_IMAGE=noobaa/noobaa-operator-bundle
VERSION="${{ steps.date.outputs.date }}"
echo "::warning ${VERSION}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
OPERATOR_TAGS="${DOCKER_OPERATOR_IMAGE}:${{ github.event.inputs.branch }}-${VERSION}${{ steps.suffix.outputs.suffix }}"
OPERATOR_BUNDLE_TAGS="${DOCKER_OPERATOR_BUNDLE_IMAGE}:${{ github.event.inputs.branch }}-${VERSION}${{ steps.suffix.outputs.suffix }}"
OPERATOR_OCS_DEV_TAG="ocs-dev/noobaa-operator:${{ github.event.inputs.branch }}-latest"
echo "::warning ${CORE_TAGS}"
echo "operatortags=${OPERATOR_TAGS}" >> $GITHUB_OUTPUT
echo "operatorbundletags=${OPERATOR_BUNDLE_TAGS}" >> $GITHUB_OUTPUT
echo "ocsdevlatest=${OPERATOR_OCS_DEV_TAG}" >> $GITHUB_OUTPUT
- name: Update Core Release
id: update-release
run: |
sudo docker manifest inspect noobaa/noobaa-core:${{ github.event.inputs.branch }}-${{ steps.prep.outputs.version }}${{ steps.suffix.outputs.suffix }} > /dev/null || exit 1
echo "::found version ${{ github.event.inputs.branch }}-${{ steps.prep.outputs.version }}${{ steps.suffix.outputs.suffix }}, updating image version"
- name: Login to DockerHub Registry
run: echo ${{ secrets.GHACTIONSDOCKERHUB }} | docker login -u ${{ secrets.GHACTIONSDOCKERHUBNAME }} --password-stdin
- name: Update Core Release Image
id: update-release-image
run: |
# docker pull "noobaa/noobaa-core:${{ github.event.inputs.branch }}-${{ steps.prep.outputs.version }}${{ steps.suffix.outputs.suffix }}"
echo "::found version ${{ github.event.inputs.branch }}-${{ steps.prep.outputs.version }}${{ steps.suffix.outputs.suffix }}, updating image version in options.go"
# Update local files
sed -i 's:ContainerImageTag =.*:ContainerImageTag = "${{ github.event.inputs.branch }}-${{ steps.prep.outputs.version }}${{ steps.suffix.outputs.suffix }}":' pkg/options/options.go
# Commit Changes
# git config --local user.email "[email protected]"
# git config --local user.name "GitHub Action"
# git commit -m "Auto update core image" -a
- name: Build & Push Docker Image to DockerHub
env:
DOCKERHUB_OWNER: ${{ secrets.GHACTIONSDOCKERHUBNAME }}
run: |
make image VERSION=latest
docker tag noobaa/noobaa-operator ${{ steps.prep.outputs.operatortags }}
docker push ${{ steps.prep.outputs.operatortags }}
- name: Build Bundle
run: |
make bundle-image \
csv-name=noobaa-operator.clusterserviceversion.yaml \
core-image=quay.io/${{ github.event.inputs.branch }}-${{ steps.prep.outputs.version }}${{ steps.suffix.outputs.suffix }} \
operator-image=quay.io/${{ steps.prep.outputs.operatortags }} \
db-image=centos/postgresql-12-centos7 \
obc-crd="owned" \
BUNDLE_IMAGE=quay.io/${{ steps.prep.outputs.operatorbundletags }}
- name: Login to Quay.io Registry
run: echo ${{ secrets.GHACTIONQUAYTOKEN }} | docker login quay.io -u ${{ secrets.GHACTIONQUAYNAME }} --password-stdin
- name: Push Docker Images to Quay
env:
DOCKERHUB_OWNER: ${{ secrets.GHACTIONQUAYNAME }}
run: |
docker tag ${{ steps.prep.outputs.operatortags }} quay.io/${{ steps.prep.outputs.operatortags }}
docker push quay.io/${{ steps.prep.outputs.operatortags }}
docker push quay.io/${{ steps.prep.outputs.operatorbundletags }}
- name: Push to ocs-dev as latest
env:
DOCKERHUB_OWNER: ${{ secrets.GHACTIONQUAYNAME }}
run: |
docker login -u="${{ secrets.OCSDEVCIUSER }}" -p="${{ secrets.OCSDEVCITOKEN }}" quay.io
docker tag ${{ steps.prep.outputs.operatortags }} quay.io/${{ steps.prep.outputs.ocsdevlatest }}
docker push quay.io/${{ steps.prep.outputs.ocsdevlatest }}
- name: Push CLI Binary
run: |
make cli
make release-cli VERSION=-${{ github.event.inputs.branch }}-${{ steps.prep.outputs.version }}${{ steps.suffix.outputs.suffix }}
#noobaa-operator-cli
s3AccessKey="${{ secrets.AWSACCESSKEY }}"
s3SecretKey="${{ secrets.AWSSECRETKEY }}"
s3Bucket="noobaa-operator-cli"
region="us-east-2"
fileName="noobaa-linux-${{ github.event.inputs.branch }}-${{ steps.prep.outputs.version }}${{ steps.suffix.outputs.suffix }}"
cp build-releases/noobaa-linux-v-${{ github.event.inputs.branch }}-${{ steps.prep.outputs.version }}${{ steps.suffix.outputs.suffix }} ${fileName}
.travis/upload-s3-object-using-curl.sh ${s3AccessKey} ${s3SecretKey} ${s3Bucket}@${region} ${fileName} ${fileName}