|
| 1 | +name: Build Artifacts |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + tag: |
| 7 | + required: true |
| 8 | + type: string |
| 9 | + go-md5: |
| 10 | + required: true |
| 11 | + type: string |
| 12 | + docker-md5: |
| 13 | + required: true |
| 14 | + type: string |
| 15 | + branch: |
| 16 | + required: true |
| 17 | + type: string |
| 18 | + authenticated: |
| 19 | + required: true |
| 20 | + type: boolean |
| 21 | + force: |
| 22 | + description: Always build artifacts |
| 23 | + type: boolean |
| 24 | + default: false |
| 25 | + ic-version: |
| 26 | + required: true |
| 27 | + type: string |
| 28 | + runner: |
| 29 | + type: string |
| 30 | + default: ubuntu-24.04 |
| 31 | + go-proxy: |
| 32 | + required: true |
| 33 | + type: string |
| 34 | + go-path: |
| 35 | + required: true |
| 36 | + type: string |
| 37 | + image-matrix-oss: |
| 38 | + required: true |
| 39 | + type: string |
| 40 | + image-matrix-plus: |
| 41 | + required: true |
| 42 | + type: string |
| 43 | + image-matrix-nap: |
| 44 | + required: true |
| 45 | + type: string |
| 46 | + |
| 47 | +defaults: |
| 48 | + run: |
| 49 | + shell: bash |
| 50 | + |
| 51 | +permissions: |
| 52 | + contents: read |
| 53 | + |
| 54 | +jobs: |
| 55 | + binaries: |
| 56 | + name: Build Binaries |
| 57 | + runs-on: ${{ inputs.runner }} |
| 58 | + permissions: |
| 59 | + contents: read |
| 60 | + id-token: write |
| 61 | + steps: |
| 62 | + - name: Checkout Repository |
| 63 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 64 | + with: |
| 65 | + ref: ${{ inputs.branch }} |
| 66 | + |
| 67 | + - name: Setup Golang Environment |
| 68 | + uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 |
| 69 | + with: |
| 70 | + go-version-file: go.mod |
| 71 | + if: ${{ inputs.force }} |
| 72 | + |
| 73 | + - name: Setup netrc |
| 74 | + run: | |
| 75 | + cat <<EOF > $HOME/.netrc |
| 76 | + machine azr.artifactory.f5net.com |
| 77 | + login ${{ secrets.ARTIFACTORY_USER }} |
| 78 | + password ${{ secrets.ARTIFACTORY_TOKEN }} |
| 79 | + EOF |
| 80 | + chmod 600 $HOME/.netrc |
| 81 | + if: ${{ inputs.force || inputs.authenticated == 'true' }} |
| 82 | + |
| 83 | + - name: Build binaries |
| 84 | + uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 |
| 85 | + with: |
| 86 | + version: latest |
| 87 | + args: build --snapshot --clean |
| 88 | + env: |
| 89 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 90 | + GOPATH: ${{ inputs.go-path }} |
| 91 | + GOPROXY: ${{ inputs.go-proxy }} |
| 92 | + AWS_PRODUCT_CODE: ${{ secrets.AWS_PRODUCT_CODE }} |
| 93 | + AWS_PUB_KEY: ${{ secrets.AWS_PUB_KEY }} |
| 94 | + AWS_NAP_DOS_PRODUCT_CODE: ${{ secrets.AWS_NAP_DOS_PRODUCT_CODE }} |
| 95 | + AWS_NAP_DOS_PUB_KEY: ${{ secrets.AWS_NAP_DOS_PUB_KEY }} |
| 96 | + AWS_NAP_WAF_PRODUCT_CODE: ${{ secrets.AWS_NAP_WAF_PRODUCT_CODE }} |
| 97 | + AWS_NAP_WAF_PUB_KEY: ${{ secrets.AWS_NAP_WAF_PUB_KEY }} |
| 98 | + AWS_NAP_WAF_DOS_PRODUCT_CODE: ${{ secrets.AWS_NAP_WAF_DOS_PRODUCT_CODE }} |
| 99 | + AWS_NAP_WAF_DOS_PUB_KEY: ${{ secrets.AWS_NAP_WAF_DOS_PUB_KEY }} |
| 100 | + GORELEASER_CURRENT_TAG: "v${{ inputs.ic-version }}" |
| 101 | + if: ${{ inputs.force }} |
| 102 | + |
| 103 | + - name: Store Artifacts in Cache |
| 104 | + uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 |
| 105 | + with: |
| 106 | + path: ${{ github.workspace }}/dist |
| 107 | + key: nginx-ingress-${{ inputs.go-md5 }} |
| 108 | + if: ${{ inputs.force }} |
| 109 | + |
| 110 | + build-docker: |
| 111 | + name: Build Docker OSS |
| 112 | + needs: [binaries] |
| 113 | + strategy: |
| 114 | + fail-fast: false |
| 115 | + matrix: ${{ fromJSON( inputs.image-matrix-oss ) }} |
| 116 | + uses: ./.github/workflows/build-oss.yml |
| 117 | + with: |
| 118 | + platforms: ${{ matrix.platforms }} |
| 119 | + image: ${{ matrix.image }} |
| 120 | + go-md5: ${{ inputs.go-md5 }} |
| 121 | + base-image-md5: ${{ inputs.docker-md5 }} |
| 122 | + authenticated: ${{ inputs.authenticated }} |
| 123 | + full-build: ${{ inputs.force }} |
| 124 | + tag: ${{ inputs.tag }} |
| 125 | + branch: ${{ inputs.branch }} |
| 126 | + ic-version: ${{ inputs.ic-version }} |
| 127 | + runner: ${{ inputs.runner }} |
| 128 | + permissions: |
| 129 | + contents: read |
| 130 | + actions: read |
| 131 | + id-token: write |
| 132 | + packages: write |
| 133 | + pull-requests: write # for scout report |
| 134 | + secrets: inherit |
| 135 | + |
| 136 | + build-docker-plus: |
| 137 | + name: Build Docker Plus |
| 138 | + needs: [binaries] |
| 139 | + strategy: |
| 140 | + fail-fast: false |
| 141 | + matrix: ${{ fromJSON( inputs.image-matrix-plus ) }} |
| 142 | + uses: ./.github/workflows/build-plus.yml |
| 143 | + with: |
| 144 | + platforms: ${{ matrix.platforms }} |
| 145 | + image: ${{ matrix.image }} |
| 146 | + target: ${{ matrix.target }} |
| 147 | + go-md5: ${{ inputs.go-md5 }} |
| 148 | + base-image-md5: ${{ inputs.docker-md5 }} |
| 149 | + branch: ${{ inputs.branch }} |
| 150 | + tag: ${{ inputs.tag }} |
| 151 | + authenticated: ${{ inputs.authenticated }} |
| 152 | + full-build: ${{ inputs.force }} |
| 153 | + ic-version: ${{ inputs.ic-version }} |
| 154 | + runner: ${{ inputs.runner }} |
| 155 | + permissions: |
| 156 | + contents: read |
| 157 | + id-token: write |
| 158 | + pull-requests: write # for scout report |
| 159 | + secrets: inherit |
| 160 | + |
| 161 | + build-docker-nap: |
| 162 | + name: Build Docker NAP |
| 163 | + needs: [binaries] |
| 164 | + strategy: |
| 165 | + fail-fast: false |
| 166 | + matrix: ${{ fromJSON( inputs.image-matrix-nap ) }} |
| 167 | + uses: ./.github/workflows/build-plus.yml |
| 168 | + with: |
| 169 | + platforms: ${{ matrix.platforms }} |
| 170 | + image: ${{ matrix.image }} |
| 171 | + target: ${{ matrix.target }} |
| 172 | + go-md5: ${{ inputs.go-md5 }} |
| 173 | + base-image-md5: ${{ inputs.docker-md5 }} |
| 174 | + branch: ${{ inputs.branch }} |
| 175 | + tag: ${{ inputs.tag }} |
| 176 | + nap-modules: ${{ matrix.nap_modules }} |
| 177 | + authenticated: ${{ inputs.authenticated }} |
| 178 | + full-build: ${{ inputs.force }} |
| 179 | + ic-version: ${{ inputs.ic-version }} |
| 180 | + runner: ${{ inputs.runner }} |
| 181 | + permissions: |
| 182 | + contents: read |
| 183 | + id-token: write # gcr login |
| 184 | + pull-requests: write # for scout report |
| 185 | + secrets: inherit |
0 commit comments